View Single Post
Old 06-22-2008, 03:55 PM   #8 (permalink)
drewbee
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

Please see the following article:
Storing Hierarchical Data in a Database [PHP & MySQL Tutorials]

I am not sure how you have your database setup, but my guess is you allow subcategories upon subcategories correct? And you link them by 'parent_id', which can cause a huge amount of queries.

The tutorial above can show you how to setup categories properly, above all, get all children of x category and its breadcrumbs with a grand total of 3 queries.

This method you dont have to have the sql 'follow' the tree and have to re-query each time it gets a child deeper.

They even have a function on the tutorial somewhere that will convert your parent_id linkage to the correct method.

Good luck!!
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote