Php 检查结果为空mysql
下面的mysql命令返回空结果 如何在php中检查这一点Php 检查结果为空mysql,php,mysql,Php,Mysql,下面的mysql命令返回空结果 如何在php中检查这一点 SELECT (sum(`money1`) - sum(`money2`)) as sm FROM `manfeatokasb` 下面的代码不正确,无法检查空结果 if ($result['sm'] === null ) { echo 'this command is return null result'; } 使用 您可以使用mysql\u num\u行 if(mysql_num_rows($result) != 0){
SELECT (sum(`money1`) - sum(`money2`)) as sm FROM `manfeatokasb`
下面的代码不正确,无法检查空结果
if ($result['sm'] === null )
{
echo 'this command is return null result';
}
使用
您可以使用mysql\u num\u行
if(mysql_num_rows($result) != 0){
//code if "not null"
}else{
//code if "null"
}
没有足够的代码。请发布您如何执行查询并获取
$result
。
if(mysql_num_rows($result) != 0){
//code if "not null"
}else{
//code if "null"
}