Log in

View Full Version : newbie problem - php/mysql select different tables



oscar
09-19-2009, 07:57 AM
hi guys,
absolute newbie problem...
i want to create a directory listing site.
my problem is that i want to be able to allocate unlimited categories to each entry.
so my table structure (simplified) looks like that:

master_names
id
name

category
id
cat_name

names_cats
id
master_id
cat_id


that way i can set up one table with all category names, one with all names, one with master_id and category id.

e.g.
category A
entry1
entry2
entry3

category B
entry4
entry5
entry6
entry1

category C
entry2
entry3
entry7
entry8


i'm stuck pulling the data from the db.
i want to be able to show the listing by category, but i just can't work it out.
at the moment i always end up with the full listing of all entries in names in each category. have tried a few where statements but just don' get further at all.
any hints/ ideas appreciated, can post code but it just doesn't make sense to me yet...!

oscar
09-20-2009, 03:14 AM
solved it, was related to wrong WHERE statements. thanks anyway