Alternative for mysql_num_rows using PDO

后端 未结 5 1946
逝去的感伤
逝去的感伤 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 18:55

    $stmt = $db->query('SELECT * FROM table');  
    $row_count = $stmt->rowCount();  
    echo $row_count.' rows selected';
    

提交回复
热议问题