Me, I would try something like this:
<?php
$searchstring='transvestite threesome tea party';
$terms=explode(' ',$searchstring);
$conditions=array();
for($i=0;$i<count($terms);$i++)
{
if(!empty($terms[$i]))
{
$conditions[$i]="title like '%" . trim($terms[$i]) . "%'";
}
}
$sql_str ="select url, title from fappageinfo where ";
for($i=0;$i<count($conditions);$i++)
{
if($i>0)
{
$sql_str .=" or ";
}
$sql_str .=$conditions[$i] . " ";
}
echo "sql=" . $sql_str . "<br>";
?>
the echo produces: sql=select url, title from fappageinfo where title like '%transvestite%' or title like '%threesome%' or title like '%tea%' or title like '%party%'
then use whatever flavor you want to exec the query, mysql, msqli, PDO, whatever
Hope that helps
__________________
All cookies cleared!
|