PHP/MySQL best practice tutorial
| From: | Tony Crockford | Date: | Tue, 29 Jul 2003 17:22:39 +0000 |
| Subject: | PHP/MySQL best practice tutorial | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-157341@lists.php.net to get a copy of this message | ||
I have a mySQL database containing items that are categorised four
levels deep.
when I'm getting the data out (in a tree structure) I'm nesting SQL
queries inside array traversing loops (select distinct category, while
$row= echo stuff select distinct subcat, while $row= echo stuff etc)
I'm sure this isn't the best way and I oought to be selecting all the
items and then doing some sort of sorting and then traversing the whole
lot, doing one thing until the category changes and then doing something
else until the category changes again and so on.
can anyone point me to a tutorial that would help me switch from nested
select statements to something more elegant?
Thanks
Tony