i have a database where i have title
Titles
Celeste from the moon
Sweet Dreams Tomorrow
Time machine from past
Now when i do my search query for keyword lets say 'celeste from' then it displays me what i want i.e. Celeste from the moon. However if i change my query to 'celeste the moon' , then it shows me no results.
This is my query script
if(!empty($_REQUEST['string']))
{
$search_string = " title LIKE %".mysql_real_escape_string($_REQUEST["string"])."%'";
$query = mysql_query("SELECT * FROM products WHERE ".$search_string);
$row = mysql_num_rows($query) or die(mysql_error());
$row = $row;
$cur_page = $_GET['page'];
$cur_page = ($cur_page < 1)? 1 : $cur_page;
$offset = ($cur_page-1)*$per_page;
$pages = ceil($row/$per_page);
$start = (($cur_page - $num_links) > 0) ? ($cur_page - ($num_links - 1)) : 1;
$end = (($cur_page + $num_links) < $pages) ? ($cur_page + $num_links) : $pages;
$res = mysql_query("SELECT * FROM products WHERE ".$search_string." ORDER BY title LIMIT ".$per_page." OFFSET ".$offset);
while($row=mysql_fetch_array($res))
{
include ('include/form.php');
}
}
I tried various ways but just not able to get the desired results.