Ive tried and Ive tried, but nothing seems to work. My objective is simple: I want to do a 'SELECT foo WHERE bar LIKE $var' for each word in a string separately, Not the whole string. (The string is text box input.) How can I loop through each word and pass it to the WHERE clause? I tried strtok and as an array.
The following code does not return a result when I know it should. If you have experience with this please help.
//'$find' is text box input
$words=split(" ", $find);
print "Query=$words[0]<hr>";
$words[0]=$one;
$sql=mysql_query ("SELECT bandname
FROM bands
WHERE bandname LIKE '$one%'
");
while ($myrow=mysql_fetch_array($sql))
{
print "$myrow[0], '$words[0]'<p>";
}