SELECT query with multiple "WHERE" Clause
| From: | Nasreen Laghari | Date: | Wed, 27 Feb 2008 23:44:23 +0000 |
| Subject: | SELECT query with multiple "WHERE" Clause | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-44681@lists.php.net to get a copy of this message | ||
Hi All,
Thank you for increasing my knowledge about PHP/MYSQL.
I am creating a SEARCH, by only using one table. The search form is same as Inserting item (search
has form of all fields in table ), difference is SEARCH page doesnt have validation . Therefore user
can enter information in any of field. I would like to know how to write a SELECT query which has
multiple where clause with OR operator.
shall we write:
$query = mysql_query("SELECT * from gig WHERE Name='$name' || WHERE
gig_fdate='$sdate'");
OR
$query = mysql_query("SELECT * from gig WHERE gigName='$gig_name' OR WHERE
gig_fdate='$sdate'");
OR
$query = mysql_query("SELECT * from gig WHERE gigName='$gig_name' ||
gig_fdate='$sdate'");
Regards
Nasreen
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping