Re: searching multiple fields
| From: | Richard Davey | Date: | Thu, 14 Jul 2005 09:14:51 +0000 |
| Subject: | Re: searching multiple fields | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-218661@lists.php.net to get a copy of this message | ||
Hello Ross,
Thursday, July 14, 2005, 9:37:10 AM, you wrote:
R> $query = "SELECT * FROM sheet1 WHERE 'name' or 'area or 'organisation
R> LIKE
R> '$search_field%'";
SELECT * FROM blah WHERE name LIKE '$search%' OR area LIKE '$search%'
OR blahblah LIKE '$search%'
etc
If you want to add extra conditions you can do so like this:
SELECT * FROM blah WHERE (name LIKE '$search%' AND id > 10) OR area LIKE
'$search%'
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov