Welcome Guest, Not a member yet? Register   Sign In
Number of rows in Query Results

(This post was last modified: 01-29-2018, 06:31 AM by iceleo.)


I think this feature is useful, sometime I need to check the value exists in database. Of course I can check by if $query->getRow() like this

PHP Code:
if ($query->getRow()) {...} 

In some case, I want to get the total of rows, I must do like this
PHP Code:
$rows $query->getResult();
$count count($rows); 
So I prefer to use a simple way like $query->getNumRows();


If I understood you right, in CI4 there is countAllResults() method
https://github.com/bcit-ci/CodeIgniter4/...uilder.php (line 1405)

and count_all_results() method in CI3

Theme © iAndrew 2016 - Forum software by © MyBB