Re: One search or lots of little sqls?
| From: | David Robley | Date: | Tue, 09 Apr 2002 02:45:28 +0000 |
| Subject: | Re: One search or lots of little sqls? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18333@lists.php.net to get a copy of this message | ||
In article <000701c1df50$0e2a1060$2101a8c0@pbi.net>, john@jomari.com
says...
> I'm building a site that will eventually hold several hundred photos. (Kids
> soccer photos.) The first page will display a table of 9 thumbnails, with
> buttons at the bottom to move 9 forward or 9 back (after the first 9, of
> course).
>
> The names of the files will be in a MySQL database and the pages built in
> PHP. (This should satisfy the topic-sensitive on this list.)
>
> Would it be better to:
>
> Gather all of the names in one PHP array, thus having only one MySQL call,
> and pass that array as a hidden value using $PHP_SELF
>
> Or would it be better to have the page pull the data using LIMIT to pick the
> portion to display?
>
> We are not talking a high-volume site, perhaps a dozen people at one time.
>
> John Hughes
>
>
No contest - use LIMIT. It also avoids the potential problem where
additional images are added whilst someone is cruising the db; and
depending on the size of the data you are apssing, there may be potential
hiccups. On the other hand, if you only need to pass the current position
in the list....
--
David Robley
Temporary Kiwi!
Quod subigo farinam