Hi, I have a table thats laid out something like the following....
my question is, what's the best way of finding the full category list given 1 category id. I really want to return the result as an array of category names, with the category id's being the array keys.
currently im trying to make a recursive function, but i thought maybe there is a better (more efficient?) way using a do while() loop. Or even a way of recursing with an sql statement?
Thanks for any help!
Andy
Code:
cat_id, cat_name, cat_parent 1 furniture null 2 electrical null 3 tvs 2 4 desks 1 5 corner desks 4 6 sony tvs 3 7 wardrobe 1
my question is, what's the best way of finding the full category list given 1 category id. I really want to return the result as an array of category names, with the category id's being the array keys.
currently im trying to make a recursive function, but i thought maybe there is a better (more efficient?) way using a do while() loop. Or even a way of recursing with an sql statement?
Thanks for any help!
Andy
Comment