I can search for a school that has EITHER ‘Sports’ OR ‘Graduation’ using this query:
SELECT schools.school_name, schools.sID FROM schools, school_highlight_details WHERE schools.sID = school_highlight_details.sid AND (school_highlight_details.hid = 2 OR school_highlight_details.hid = 4 ) GROUP BY schools.sID
But now I want to search for a school that has BOTH highlights ‘Sports’ AND ‘Graduation’.
I have 3 tables:
1. school (sID, school_name) 2. highlights (hID,highlight) 3. school_highlight_details (dID,sid,hid).
Jason Givhan wrote:
I have 3 tables:
1. school (sID, school_name) 2. highlights (hID,highlight) 3. school_highlight_details (dID,sid,hid).
I have set up a search to allow the user to submit a school name OR highlights(highlights is set up in an array of checkboxes), and then displaying any school name that fullfill the requirements.
What I need to do now is set up an array to search for a school name AND highlights. If a person types in a name (or just one letter from a name, like 'm') AND they check off a couple of highlights checkboxes(ex: Sports and Graduation), a query should return the results of any school name starting with 'm' that has the highlights of 'Sports' and 'Graduation'.
If you think you can help me, just email me at jason@billtron.com. If you need more information, let me know.
Thank you,
Jason Givhan
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php