Jump to content

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


Erica McLane

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.