I'm working on a search form where php dynamically writes the search query depending on the users selection of checkboxes.
My table structure is:
table: mcl_media
person_id
mtype_id
table: mcl_subject
person_id
subject_id
Example Record (where all tables media/subject... have same structure)
mcl_media
person_id | mtype_id
2 | 4
2 | 5
7 | 1
My main problem is when I run a query like:
SELECT * FROM mcl_media M WHERE (M.mtype_id="4") OR (M.mtype_id="5")
I get an answer of person_id = 2, BUT if I try substituting the OR with an AND to look for records that have both id#'s for one person_id I don't get a result.
Do I need some form of Inner join? (I'm kind of new to MySQL)
The problem gets more complicated when the user tries a search that calls on both tables (media and subject), but I guess I should solve this first before working with multiple tables.
Any help is greatly appreciated!!!!!!!!