<?
#say...
$query = "music rock";
#you could split these using explode()
$splitquery = explode(" ",$query); //split where there is a space
$number = count($splitquery); //count the number of elements splitted to

#beginning of database query
$q1= "select * from $urls_table where ";

#second part of query
$i = 0;
while ($i<$number) //while there are still array elements to go
{
$q1 .= "field LIKE '%$splitquery[$i]%' OR ";
$i++; //increment $i
}