mysql_fetch_assoc什么都没有返回(不是null,不是0,不是“”)

I am trying to get data out of my $result. When there is one result, it works fine. But when I want to check if there is a result and there is none I can't use $array anymore at all. If I run those both, they display nothing:

$query = "SELECT " . $select . " FROM " . $table . " WHERE `" . $field . "` = '" . $fieldis . "'";

$result = mysql_query($query) or die(mysql_error());

$array = mysql_fetch_assoc($result) or die(mysql_error());
if(!is_null($array)){echo "hahaha!";} else {echo "hahahahaha!";}

Result is no text at all. If I place an echo before the $array = mysql_fetch.... is works...What is messing with me here? :)

mysql_query don't raise an exception error, it raises a warning message instead. So die() will not be called.

However, the mysql library is deprecated, you should use mysqli.

See php documentation for further information at http://www.php.net