|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||||||
|
||||||||
|
Help with catagories and sub-catagories! Confused.
Hello everyone. I know this is my first post but I have been at this
for awhile now and cannot seem to get it to work properly. This is a 2 part question the first part is of the most important however. Any help would be greatly appreciated it. Part 1: I have a table setup with catagories and subcats like so: id main_id cat_name 1 0 Main 2 1 Catagory 1 3 1 Catagory 2 4 1 Catagory 3 5 2 Cat 1 Sub-Cat 1 6 2 Cat 1 Sub Cat-2 7 5 Cat 1 Sub-Cat 1 Sub-Cat and so on up to three total sub-cats, could be as little as 1 sub-cat. Now what I am trying to do in this part is if there are no other sub-cats I would like to go to query a different table and give its output. This is for a classified ads system. If we get to the last sub-cat I will query the ads table and show the ads list. Here is what I have for displaying the sub-cats for each catagory: php Code:
If anyone can see how I can make it where it will stop looking for catagories and go onto a different query I would greatly appreciate it. Part 2: What I am trying to do here is no matter how deep the sub-cats go I can get them all without haveing to do a different loop for each. This way there can be unlimited sub-cats like so: Cat 1 -- Sub Cat 1 ---- Sub-Sub Cat 1 ------ Sub-Sub-Sub Cat 1 and so on and so on. This would go into a select drop down box. Here is the code I am currently using: php Code:
Again any help would be greatly appreciated. Thanks in advance. Regards, Ray |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Help with catagories and sub-catagories! Confused. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|