Hello.
I am wondering if there is a 'best way' of setting up a keyword search with PHP & MySQL.
For multiple words in a string . . . I could explode the string and then run:
$sql="SELECT* FROM TABLE WHERE field LIKE '%keyword%' AND field LIKE '%secondkeyword%' field LIKE '%thirdkeyword%'";
through a loop generating the sql conditions.
A bit adhoc, but works.
This issue must be common for searching text fields. Is there a suitable SQL construct or something done in PHP for this?
Many thanks!
Tim
PS - Alternative I find unacceptably poor:
Again use explode to do:
$sql="SELECT* FROM TABLE WHERE field LIKE '%keyword%secondkeyword%thirdkeyword%";
etc.
however, this requires the correct sequence and it pretty messy.