Page 1 of 1

Multiple Queries in mySQL in a single statement?

Posted: Sun Mar 14, 2004 9:35 am
by frogontop
I'm trying to do an advanced search function with my database.
So far the only thing that works is a two field Search.
This is the sql statement.

SELECT *
FROM contacts
WHERE region LIKE '%region%' AND sport LIKE '%sport%'
ORDER BY sport ASC

What I really want to happen is (this is just theory so bear with me)

SELECT *
FROM contacts
WHERE region LIKE '%region%' AND sport LIKE '%sport%' AND level LIKE '%level%' AND genre LIKE '%genre%' AND name LIKE '%name%'
ORDER BY sport ASC

Is this possible or am I barking up the wrong tree... I'm just not sure how to search more than two fields in a database or the correct syntax if possible.

Any help would be greatly appreciated!

Posted: Sun Mar 14, 2004 2:28 pm
by penguinboy
That should work.

Posted: Sun Mar 14, 2004 7:17 pm
by frogontop
Yeah, it should've but it didn't. I figured out (I use Dreamweaver MX for graphical aspects) that dreamweaver was fudging up my sql statements, I switched over to notepad and things worked fine.