Hello, I am using two searches. But niether will allow for search strings with more than one word.
Search.php
/* Only works using one word
if ($search) // performs search only if a search string was entered.
{
mysql_connect() or die ("Problem connecting to Database");
// Define a SQL Select Query
$sql= mysql_query("SELECT wname, title, keywords, description, city, country, category FROM directory WHERE city LIKE '%$search%' || wname LIKE '%$search%' || title LIKE '%$search%' || keywords LIKE '%$search%' || description LIKE '%$search%' || country LIKE '%$search%' || category LIKE '%$search%'", $db);
Search2.php
/* Does not work at all
if ($search) // performs search only if a search string was entered.
{
mysql_connect() or die ("Problem connecting to Database");
$terms = preg_split("/\s+/",$search);
$term = "%".$terms."%";
// Define a SQL Select Query
$sql= mysql_query("SELECT wname, title, keywords, description, city, country, category FROM directory
WHERE city LIKE '$term' || wname LIKE '$term' || title LIKE '$term' || keywords LIKE '$term' || description LIKE '$term' || country LIKE '$term' || category LIKE '$term'", $db);
Does anyone have any ideas how i can make my search form get results using more than one word?
~Shane