kerkor
asked on
Need help with query
PHP and SQL
Hello all. I am hoping for some help in determining the needed SQL and best way to create a resulting html SELECT input.
Details:
- I need to create an html select that contains a treelike category structure.
- I only want the categories to be in the select if there are files with the category id
- I want the select to demonstrate the level. For example:
Cat 1
Sub Cat 1
Sub Sub Cat 1
Sub Cat 2
Cat 2
Here are the details on the tables/fields
tblCategory
CategoryID (int pk)
CategoryName (varchar)
TopLevelFlag (tinyint)
ParentCategoryID (int)
tblFileCategory
FileID
CategoryID
Additional Notes:
Some categories do not directly have files associated. For example
Living Accomodations
Home
Small
[Small contains 1 file]
Large
Apartment
[Apartment contains 5 files]
Condo
Please help me come up with the sql and method that creates the options for the select. It will be fun :). I will award points quickly. I have to have this completed by tomorrow night. Thanks EE!
Best,
kerkor
Hello all. I am hoping for some help in determining the needed SQL and best way to create a resulting html SELECT input.
Details:
- I need to create an html select that contains a treelike category structure.
- I only want the categories to be in the select if there are files with the category id
- I want the select to demonstrate the level. For example:
Cat 1
Sub Cat 1
Sub Sub Cat 1
Sub Cat 2
Cat 2
Here are the details on the tables/fields
tblCategory
CategoryID (int pk)
CategoryName (varchar)
TopLevelFlag (tinyint)
ParentCategoryID (int)
tblFileCategory
FileID
CategoryID
Additional Notes:
Some categories do not directly have files associated. For example
Living Accomodations
Home
Small
[Small contains 1 file]
Large
Apartment
[Apartment contains 5 files]
Condo
Please help me come up with the sql and method that creates the options for the select. It will be fun :). I will award points quickly. I have to have this completed by tomorrow night. Thanks EE!
Best,
kerkor
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you can see my comment here
Bonmat86.