RE: [PHP-WIN] HOw to modify a php database query from general to specific?
| From: | Mikey | Date: | Thu, 22 May 2003 12:29:14 +0000 |
| Subject: | RE: [PHP-WIN] HOw to modify a php database query from general to specific? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-20033@lists.php.net to get a copy of this message | ||
> 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
Why can't you just generate two SQL queries and use which ever was needed?
Adding a wildcard to your WHERE clause would make it very inefficient...
Mikey