value to judge.
It’s very simple, give me an example.
Method 1:
Copy code The code is as follows:
$sql = "select * form abc"
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
if(empty($row))//Start to judge whether it is empty enough
{
echo "null";
}
else
{
echo "not null";
}
Method 2:
Copy code The code is as follows:
$sql = "select * form abc"
$result = mysql_query( $sql);
$row = mysql_fetch_array($result);
if(!$row)//Start to judge whether it is empty enough
{
echo "null";
}
else
{
echo "not null";
}
In fact, when the mysql_fetch_array function is used, if the table is empty, it will return false. At this time Naturally, $row did not assign the
value successfully.
Remember, never use $row = mysql_fetch_array($result) or die(mysql_error());
If you die later, the program execution will terminate when mysql_fetch_array changes.
http://www.bkjia.com/PHPjc/321560.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321560.htmlTechArticle value to judge. Very simple, give an example. Method 1: Copy the code. The code is as follows: $sql = "select * form abc" $result = mysql_query($sql); $row = mysql_fetch_array($resul...