you should use mysql_num_rows() to check for records returned instead of
using mysql_query().
this is because if $query is a valid $sql statement, mysql_query() will
always return a resource link. which evaluates to true.
so this will work for you:
if (mysql_num_rows($result))
echo "record
Could be wrong, but the fact that $result isn't empty doesn't mean there
are rows... it would be better to say:
if ( !empty($result) ) {
echo "VALID QUERY";
} else {
echo "INVALID QUERY";
}
Although you should probably check $result against TRUE and FALSE instead.
If you want to know h
2 matches
Mail list logo