Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这个下面的mysql命令是返回空结果。
如何在php中检查这个
SELECT (sum(`money1`) - sum(`money2`)) as sm FROM `manfeatokasb`
下面的代码不正确,无法检查空结果
if ($result['sm'] === null ) { echo 'this command is return null result'; }
利用is_null()
is_null()
if (is_null($result['sm'])) { echo 'this command is return null result'; }
您可以使用 mysql_num_rows
if(mysql_num_rows($result) != 0){ //code if "not null" }else{ //code if "null" }