Jump to content

Archived

This topic is now archived and is closed to further replies.

Erica McLane

Can`t get categories and items to work. Need help.

Recommended Posts

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?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.