Multiple work mySql database search.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all you experts who have help me often in the past, may I now ask
what is probably so simple for someone doing PHP everyday...
 
I have a product database which can be searched for a keyword in up to 3
fields; using this select query:
 
$sql_select = "SELECT * from productlist WHERE (Name LIKE
'%$SearchText%') OR (Description LIKE '%$SearchText%') OR (Keywords LIKE
'%$SearchText%') ORDER BY Name";
 
What I really want to achieve is if someone enters more than one work in
the search for, how can I get the select query to search for one, the
other, or both?
 
I've thought of putting an option on the search for the user to select
'All Words' or 'Any Word' so that the select query could deal with the
search based on the full phrase they entered or any of the words.
 
My problem is how to build the query.
 
Any help would be massively appreciated.
 
Martin

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.661 / Virus Database: 424 - Release Date: 19/04/2004
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux