PhpRiot
Follow phpriot on Twitter
Sponsored Link

Listing 2745

Submitted by php_search, 18 March 2010
//variables
$search = $_GET['search'];
$search_exploded = explode(" ",$search);
$search_term_count = count($search_exploded);
 
//construct sql query ending
if($search_term_count >= "1")
{
    $x = "0";
    $construct = "tags LIKE '%".$search_exploded[$x]."%'";
}
 
if($search_term_count >= "2")
{
    $x++;
    $construct = $construct." OR tags LIKE '%".$search_exploded[$x]."%'";
}
 
//display sql query
$sql = "SELECT * FROM pages WHERE ".$construct;
Submit a Follow Up