Erica McLane Posted May 29, 2003 Share Posted May 29, 2003 I have the following MySQL tables: Categories CategoryID VARCHAR 30; CategoryName VARCHAR 30; ------------------------------------------- Books BookID VARCHAR 20; CategoryID VARCHAR 30; BookName VARCHAR 50; I want to put them on a table (HTML formated). There will be two columnts - one for \'CategoryName\' and one for \'BookName\'. The left column should be filled with the contents of \'CategoryName\' like this: --------------- |Adventure| --------------- |Comic | or whatever is in the MySQL table. In the second column I want a drop-down style listboxes filled with the contents of \'BookName\'. The listboxes should be exactly the same number as the Categories. (i.e. One listbox (filled with the BookName contents that match the CategoryName field) in the row of the Adventure category. So, my question is \"How to get the contents of the BookName fields that have the same CategoryID (in Books) number as the category Adventure in CategoryName which will have CategoryID 1. Here is a table: Categories ---------------------- CategoryID | CategoryName 1 | Adventure 2 | Comic 3 | Horror Books ----------------------------------------------- BookID | CategoryID |BookName 1 | 1 | AdventureBook 2 | 1 | Another Adv. Book 3 | 2 | Asterix So, depending on the CategoriID value I want to fill the apropriate listbox with the corresponding values. In the page where Adventure lies the checkbox should have AdventureBook and Another Adv. Book. Got the idea? Can you help me? Thanks in advance? Quote Link to comment https://forums.phpfreaks.com/topic/525-cant-get-categories-and-items-to-work-need-help/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.