Alternative for mysql_num_rows using PDO

后端 未结 5 1936
逝去的感伤
逝去的感伤 2020-11-27 18:41

Right now I have a PHP file that does a MYSQL query and then counts rows like this:

$count=mysql_num_rows($result);


if ($count == 1) {
    $message = array         


        
5条回答
  •  独厮守ぢ
    2020-11-27 19:03

    Can be like that...

    $numRows = $conn->query("SELECT COUNT(*) FROM yourtable")->fetchColumn();
    echo $numRows; 
    

提交回复
热议问题