Welcome Guest, Not a member yet? Register   Sign In
Is there no longer a need for num_rows()?
#1

(This post was last modified: 08-11-2019, 10:04 PM by tgix.)

Looking at CI4 and working with databases I can't find a way to get the number of rows returned from a query. 
In CI3 I often did:
PHP Code:
/** @var CI_DB_result $query */
$query $this->db->get(TBL_INVITES);

if (
$query->num_rows() !== 1)
{
    return 
FALSE;
}

/** Continue processing **/ 

Should I do like this in CI4 or is there a better way?
PHP Code:
if (count($query->getResultArray()) !== 1)
{
    return 
false;

Reply


Messages In This Thread
Is there no longer a need for num_rows()? - by tgix - 08-11-2019, 10:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB