I'm having a problem when I try to run a search program I made. When I do:
if (isset($query)) {
$query = preg_replace("#[^0-9a-z]#i", "", $query);
$query = array($db->q("select * from posts where title like $query") ,
$db->q("select count(*) from posts where title like $query"));
if ($query[1] == 0){
$out = "Sorry: There is no results";
} else {
while ($row = mysql_fetch_array($query[0])){
$title = $row['title'];
$exep = $row['exepert'];
$out .= "<div>".$title."".$exep."</div>";
}
}
}
It always says there are no search results, but when I force it to go to the else statement it says both the results and the count are booleans (the number 0).
If anybody needs extra code to help me please ask!
Thanks in advance!