Count number of rows buffered in sqlite result set

后端 未结 4 1531
说谎
说谎 2020-12-22 04:58

I am using count function to get the number of rows buffered in a resultset.

But it always returns count as one even if resultset is empty.

Please see the co

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-22 05:38

    Call numRows() on the result set.

    From http://php.net/manual/en/function.sqlite-num-rows.php

    query("SELECT * FROM mytable WHERE name='John Doe'");
    $rows = $result->numRows();
    
    echo "Number of rows: $rows";
    ?>
    

提交回复
热议问题