Results 1 to 1 of 1
Thread: Matching one or more keywords
Feb 26, 2005, 12:32 #1
- Join Date
- Nov 2001
- London, UK
- 0 Post(s)
- 0 Thread(s)
Matching one or more keywords
Below is a portion of PHP (which works fine), although I need to alter the SQL query so that a row with 1 or more of the words is returned. I think that it only returns rows with all of the words at the moment. Any suggestions would be appreciated.
$q = stop_sql_inj($_GET[q]);
$q = str_replace(" ","%%%%",$q);
$my_select_001 = mysql_query("SELECT * FROM mytable
WHERE keywords LIKE '%%$q%%'
AND allow = '1' ORDER BY RAND() LIMIT 1");