Jump to content


Photo

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


  • Please log in to reply
No replies to this topic

#1 Erica McLane

Erica McLane
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 29 May 2003 - 12:53 PM

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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users