
June 17th, 2000, 11:00 PM
|
|
Contributing User
|
|
Join Date: Jan 2000
Posts: 79
Time spent in forums: < 1 sec
Reputation Power: 14
|
|
|
<?
#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
}
#remove the extra " OR" from the end
$q1 = substr($q1,0,-3);
echo "$q1"; //just so u can see it works
mysql_query($database,$q1);
?>
this one took me a little while...works for me so should work for you
good luck
Basil
[This message has been edited by 'tantrum (edited June 17, 2000).]
|