X-Original-To: pgsql-php@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 9CCA3925F24 for ; Sat, 31 May 2003 01:00:03 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 86648-08 for ; Sat, 31 May 2003 00:59:49 -0400 (EDT) Received: from MAIL.nucleus.com (mail.nucleus.com [207.34.93.23]) by developer.postgresql.org (Postfix) with ESMTP id 6803E925CC0 for ; Sat, 31 May 2003 00:59:49 -0400 (EDT) Received: from dsl-mtryl-209-5-169-118-cgy.nucleus.com (unverified [209.5.169.118]) by MAIL.nucleus.com (Vircom SMTPRS 2.0.244) with ESMTP id ; Fri, 30 May 2003 22:59:48 -0600 From: "Andrew J. Kopciuch" Reply-To: akopciuch@bddf.ca Organization: BDDF Consulting To: Bruce Young , pgsql-php@postgresql.org Subject: Re: DESIGN CONCEPT (performance) - switch/arrays/forms Date: Fri, 30 May 2003 22:58:48 -0600 User-Agent: KMail/1.5 References: <20030530234143.2520.qmail@web10403.mail.yahoo.com> In-Reply-To: <20030530234143.2520.qmail@web10403.mail.yahoo.com> X-MailKey: Flyers winning makes BDDF happy MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200305302258.48716.akopciuch@bddf.ca> X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/57 X-Sequence-Number: 2062 Why not just store the types in the DB and query that? -- table definition create table categories ( type whateverTypeThisFieldActuallyIs (ie int) primary key, name text, form text ); // PHP code $type = $HTTP_GET_VARS['type']; $rv = pg_exec($dbConnection, "SELECT form FROM categories WHERE type = '$type';"); if (pg_numrows($rv) > 0) { list($form) = pg_fetch_row($rv, 0); include($form); } else { show_error("Item Type not found", $type); } No arrays ... no loops. One simple IF. Should do what you need. I have worked on sites where the entire content is stored in the database ... works fine. Pefectly fast. Have you looked into PHP cache extensions if speed is an issue for file parsing? try: http://www.php-accelerator.co.uk/