以下の mysql コマンドは null の結果を返します。
PHPでこれを確認する方法
SELECT (sum(`money1`) - sum(`money2`)) as sm FROM `manfeatokasb`
以下のコードは正しくなく、null の結果をチェックできませんでした
if ($result['sm'] === null )
{
echo 'this command is return null result';
}
使用する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"
}