View Single Post
06-22-2008, 02:55 PM
Join Date: May 2008
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.
View Public Profile
Send a private message to drewbee
Find More Posts by drewbee