Hi there,

I know this is probably a REALLY simple problem, but I can't get this to work.  I need 
to get it to cycle through each word and do a search, I used this as sent from Beau 
Lebens (Thank you) but I can't get it to work.  It works on 1 word querie but if I 
enter more than 1 it says can't execute query, please help and tell me what i'm doing 
wrong :-)

Thank you so much.





$words = explode(" ", $test);

// create connection
$connection = mysql_connect("Localhost","!!!","!!!") or die("Couldn't make a 

// select database
$db = mysql_select_db("tas", $connection)
 or die("Couldn't select database.");

$sql = "SELECT distinct description, email, url, country, category, type, rating from 
search6  WHERE ";
foreach ($words as $word) {
$sql .= "description LIKE '%word%'";
$sql .= "AND category = '$category' AND country = '$country' AND type = '$type' ORDER 
BY description";

$sql = mysql_query($sql,$connection)
 or die("Couldn't execute query.");

Reply via email to