我想算其中id是讓我們說32這個命令行:計數表中的行返回1個行時表是空
$countReviews = Yii::$app->db->createCommand("SELECT COUNT(*)
FROM `product_review`
WHERE `product_review`.`product_id`=$book->id")->execute();
有表中沒有行,但這個返回1作爲結果。這是爲什麼 ?這是完成任務的正確方法嗎?謝謝!
您確定它返回1或其他值嗎? –