Possible Duplicate:
php / Mysql best tree structure
I'm creating a shop script and I have a little problem. I need to create a php array of tree shop categories, for example:
my mysql table (categories):
'id', 'category_id', 'parentCategory_id'
1, 11, 0
2, 12, 0
3, 13, 12
4, 14, 12
5, 15, 14
6, 16, 0
if parentCategory_id==0
there is no parent. PHP array should look like this: https://i.stack.imgur.com/PLJOL.jpg.
But I'm not convinced to do it with this method, so if you have any suggestion or solution please help me.
EDIT: Maybe I should display categories in xml? how I can do it? I havent any ideas...