HOw to modify a php database query from general to specific?
| From: | Acorn Tutors | Date: | Thu, 22 May 2003 12:07:27 +0000 |
| Subject: | HOw to modify a php database query from general to specific? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-20032@lists.php.net to get a copy of this message | ||
Hi folks,
I have a database query that I wanted to modify. If a person wanted to
search for any item in a field (i.ie. NO Preference in a Web page form), but
only certain items in another field, how would I set up the php code to do
this
Would it be something like this?
select * from TABLE1 where FIELD2 = donuts AND FIELD3 = ????
What would I put in the ???? to indicate that I wanted to select everything
from FIELD3. I ask this because if the user actually selects an item for the
FIELD3 query (as opposed to no preference), the query must be able to allow
for specific searches as well as being able to search all. In other words,
are there any wildcards that can be used to easily make it so that the query
can be as broad as any row in FIELD3 or as specific as single rows in
FIELD3.
Help appreciated,
Doug