Re: Search entire MySQL database form
| From: | Nick Talbott | Date: | Tue, 05 Sep 2000 07:12:47 +0000 |
| Subject: | Re: Search entire MySQL database form | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-15246@lists.php.net to get a copy of this message | ||
>On 5 Sep, Barry Young wrote:
>> How do you search 4 or more fields of a MySQL DB from a single textfield
>> query, ie I want to be able to search an entire DB from a single HTML
input
>> field within a form.
>> Any ideas will be warmly welcomed.
>
>
>Do you mean something like:
>
>SELECT * FROM $table WHERE field1 LIKE '%$inputval%' OR field2 LIKE
>'%$inputval%' OR field3 LIKE '%$inputval%'
>
... or if you are searching for an exact match of a field you could do
something like
SELECT * FROM $table WHERE '$inputVal' IN (field1, field2, field3)
Regards
Nick Talbott
IT Policy and Strategy Manager, Powys County Council, UK
email nickt@powys.gov.uk
FAX +44 (0) 1597 824781
web http://www.powys.gov.uk and http://www.powysweb.co.uk