A
Anonymous
Guest
Hi,
I have a database setup which contains a table called "categories". Initially there was only one field in it (name) and I had my PHP get each category name, produce a link with a reference to the category and that was it. There was no need to worry about duplicate entries, as there would be none. BUT now things have got a little more complicated and as I am relatively new to using PHP and MySQL, I'm struggling.
I now have a second field in the 'categories' table called 'name2'. This field shows a sub-category (if any) of the category in 'name'. So, for example, my table could look like this:
[name]----|----[name2]
CATEGORY
CATEGORY------SUB1
CATEGORY------SUB2
And so I therefore want to produce a TOC like:
CATEGORY
->SUB1
->SUB2
(Dashes are showen here to make the display more comprehensible!)
I'm finding this a bit of a mind bender and would appreciate any help in terms of psuedocode, approach to take, or even the code if you've got nothing better to do.
Thanks!
I have a database setup which contains a table called "categories". Initially there was only one field in it (name) and I had my PHP get each category name, produce a link with a reference to the category and that was it. There was no need to worry about duplicate entries, as there would be none. BUT now things have got a little more complicated and as I am relatively new to using PHP and MySQL, I'm struggling.
I now have a second field in the 'categories' table called 'name2'. This field shows a sub-category (if any) of the category in 'name'. So, for example, my table could look like this:
[name]----|----[name2]
CATEGORY
CATEGORY------SUB1
CATEGORY------SUB2
And so I therefore want to produce a TOC like:
CATEGORY
->SUB1
->SUB2
(Dashes are showen here to make the display more comprehensible!)
I'm finding this a bit of a mind bender and would appreciate any help in terms of psuedocode, approach to take, or even the code if you've got nothing better to do.
Thanks!