On Fri, Jan 28, 2005 at 10:50:58AM -0500, Andrew Darby wrote:
> Is there a better way to do this?  (I'm working in a LAMP/WAMP environment.)

The database is your friend, you should use it :) If you are concerned
about database overhead you could implement a caching layer in between
your function call and the actual database lookup.

There are tons of options for caching in PHP, from implementing your own simple
on disk cache, using Sessions, to something fancy like an in memory cache like
memcached [1]. Remember your database and operation system probably do
caching of their own.

Another non-caching option is to simply grab as much data you can in one
select, rather than a bunch of different selects. Also make sure that
your database connection is persistent: because establishing the
database connection is typically the most expensive part of talking to a
database...with reasonable SQL statements :)

My advice is to first implement your function calls without a caching
layer, just doing simple selects, and monitor performance under load. If
things work out then your work is done! [2] If not rollback to the
earlier version, and work on a caching solution.