
November 16th, 2005
09:44 PM
Neverside Newbie
Status: Offline!
more efficient use of mysql
I'm building a navigation set of links for a shop.
In my nav there are main catagories and sub catagories, the names of which are stored in a database.
First I do a search for the main catagories, then I loop through the results printing them. After printing each line, I do another search on the db for the sub catagories listed within that main catagory and loop through printing each one of them.
So in order to print all the links in the nav, I'm having to do 14 or 15 search on the db. While each search is quite efficient individually, altogether there is quite some delay every time you change/refresh the page.
Is there a more efficient way of doing this?

November 17th, 2005
07:28 AM
Neversidian
Status: Offline!
this might help: http://www.sitepoint.com/article/hierarchical-data-database
___________________
-Developer
-Forum Leader
-NeverNET

November 17th, 2005
08:22 AM
ruby on weapon
Status: Offline!
ahh i've been wondering about this too. thanks alot for the pointing aonic ^^
___________________
digitalDream // complete Webdesign solution //
- - - - - - [ end signature ] - - - - - -

November 19th, 2005
03:18 PM
Neverside Newbie
Status: Offline!
Thanks aoinc that is the sort of thing I want.
Unfortunately I building a CMS system for the links, so that article wouldn't be too easy to update.
I've managed it now in a different way, adding columns for firstnode order numbers and secondnode order numbers.