$query = mysql_query("SELECT * FROM gig WHERE gigName='$gig_name' OR
You only use the WHERE clause once then use parenthesis, AND and OR to create
the logical conditions.
If you have access to the mysql server, maybe through phpMyAdmin or
something, I'd highly recommend forming your SQL statements using that,
then creating your PHP once you've perfected your SQL.
SQL statements can be very powerful and sometimes dangerous and it's much
easier to debug the SQL when you work with it by itself and not have to
worry about any PHP issues too.
Assuming your MySQL server is on another server, if you have a Windows
machine you can use a program like WinSQL Lite or Navicat to connection to
the MySQL server (if it allows remote connections).
phpMyAdmin is probably the easiest option though.
----- Original Message -----
From: Nasreen Laghari <[EMAIL PROTECTED]>
Date: Wed, 27 Feb 2008 15:44:23 -0800 (PST)
Subject: [PHP-DB] SELECT query with multiple "WHERE" Clause
> 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
> $query = mysql_query("SELECT * from gig WHERE gigName='$gig_name' OR WHERE
> $query = mysql_query("SELECT * from gig WHERE gigName='$gig_name' ||
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php