I am implementing a search engin by php, and i alway to have a error massage when i validate my page by the W3 Validator, error massage as following, could any one help, thanks.
end tag for "div" omitted, but OMITTAG NO was specifiedQuery was empty
You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
$rows = get_number_of_rows();
mysql_query("SET NAMES 'utf8' COLLATE 'utf8_general_ci'");
$q=getsql("affair with teen");
$rows = mysql_num_rows($result);
$sql = "SELECT DISTINCT COUNT(*) as occurences,id, subject, content FROM pinboard WHERE (";
while ( list ( $key,$val ) = each ( $search_str ) )
if( $val!='' && strlen ( $val ) > 0 )
$sql .= "((subject LIKE '%".$val."%' OR content LIKE '%".$val."%')) OR";
$sql=substr ( $sql,0, ( strLen ( $sql )-3 ) );//this will eat the last OR
//$sql .= ") GROUP BY subject ORDER BY occurences DESC LIMIT 10";
$sql .= ") GROUP BY subject ORDER BY occurences DESC ";
but when i direct assign value to $sql="SELECT DISTINCT COUNT(*) as occurences,id, subject, content FROM pinboard WHERE (((subject LIKE '%affair%' OR content LIKE '%affair%')) OR((subject LIKE '%teen%' OR content LIKE '%teen%'))) GROUP BY subject ORDER BY occurences DESC"
and validate my page by W3 validator, it has not report any error, pefect.
Could anyone tell me, why please.