simple search algorithm
Posted: Sat Mar 08, 2008 10:30 pm
Hi I am in process of making a search script. When i write the below code it doesn't give any result. also it doesn't enter the while loop. When i write the query in sql, no results are displayed.
What could be the reason?
What could be the reason?
Code: Select all
if (content_type($section_id,$fetched_section)==0)//type=text
{
$sqlcontent = "SELECT * FROM $fetched_section WHERE `trusted` = 1 AND title LIKE '".$query."%' And content LIKE '".$query."%' ORDER BY `title` ASC LIMIT 0, 10";
$resultcontent = mysql_query($sqlcontent) or die(mysql_error());
while($row = mysql_fetch_array($resultcontent)){
echo 'we are here';
echo $row['id'];
echo $row['content'];
}
}
else
echo 'non text';