Re: Sort with PHP or SQL?
| From: | Richard Lynch | Date: | Thu, 04 Jul 2002 22:46:46 +0000 |
| Subject: | Re: Sort with PHP or SQL? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105534@lists.php.net to get a copy of this message | ||
>I'm working on a way to pull menus/pages from a database. Currently I have
>this working on 2 levels - Topic headers & actual page titles - & it prints
>it out fairly nice & doesn't take long to load. What I need to do is add a
>level between the 2, a sub-header.
>
>I'm running both the apache server & mysql server on the same linux box as
>the current load isn't very high. I'm wondering whether it would be
>better/easier to Load all the topic headers into an array, then any possible
>sub-headers into a 2nd array, then the pages into a 3rd array (or even into
>a multidimensional array?). Then go through the arrays & match the pages.
>Or would it be easier to write 1 huge SQL statement & have the SQL server
>run the whole query?
*ANY* time you can sort/search in SQL, or you can do it in PHP, the SQL way
will be faster.
I'm sure there's an exception to this rule, but I've never seen it :-)
--
Like Music? http://l-i-e.com/artists.htm