Newbie Q on Arrays?
| From: | Tony Crockford | Date: | Mon, 21 Oct 2002 10:02:02 +0000 |
| Subject: | Newbie Q on Arrays? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-120712@lists.php.net to get a copy of this message | ||
Hi all,
I've got a MySQL database with lookup tables
i.e numerical reference and alphanumeric value
e.g.
ref - title
1 - Apples
2 - pears
3 - oranges
now if I want the title that matches the ref I'm currently doing an SQL
query each time.
I'm sure this isn't efficient, I've been reading about Arrays, but not
quite understanding them.
could I do one trip to the database, read the ref and title pairs, store
them in an array and whenever I need a title just search the array for
title that matches the ref?
If so, what's the PHP syntax? code samples or tutorial links greatly
appreciated.
Many thanks
Tony
--
http://www.maccaws.org/
[Making A Commercial Case for Adopting Web Standards]