From: Andrew J. Kopciuch <akopciuch@bddf.ca>
To: Bruce Young <hbrucey@yahoo.com>
To: pgsql-php@postgresql.org
Subject: Re: DESIGN CONCEPT (performance) - switch/arrays/forms
Date: Fri, 30 May 2003 22:58:48 -0600
Message-ID: <200305302258.48716.akopciuch@bddf.ca> (raw)
In-Reply-To: <20030530234143.2520.qmail@web10403.mail.yahoo.com>
References: <20030530234143.2520.qmail@web10403.mail.yahoo.com>
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/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: akopciuch@bddf.ca, hbrucey@yahoo.com
Subject: Re: DESIGN CONCEPT (performance) - switch/arrays/forms
In-Reply-To: <200305302258.48716.akopciuch@bddf.ca>
References: <20030530234143.2520.qmail@web10403.mail.yahoo.com> <200305302258.48716.akopciuch@bddf.ca>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox