Welcome Guest, Not a member yet? Register   Sign In
Very Simple Auth Helper
#5

(This post was last modified: 10-19-2020, 05:32 PM by nc03061981.)

(10-19-2020, 06:02 AM)InsiteFX Wrote: Instead of using getResult(); which is for multiple records use getRow(); single record.

You could also useĀ $this->db->countAllResults(); Instead of count();

- countAllResults() will execute query again and then count results, so only use this method when you not yet executed query
- count($query->getResult()) only count nums of result return, so use this when you executed query
- count($query->getResult()) will faster count($query->getRow()), because getRow will call ->getFirstRow before count

- to check have result or not, should use empty($query->getResult())
- to check nums rows, should use count($query->getResult())

Learning CI4 from my works, from errors and how to fix bugs in the community

Love CI & Thanks CI Teams

Reply


Messages In This Thread
Very Simple Auth Helper - by nc03061981 - 10-16-2020, 06:32 AM
RE: Very Simple Auth Helper - by MGatner - 10-16-2020, 06:35 AM
RE: Very Simple Auth Helper - by nc03061981 - 10-16-2020, 06:38 AM
RE: Very Simple Auth Helper - by InsiteFX - 10-19-2020, 06:02 AM
RE: Very Simple Auth Helper - by nc03061981 - 10-19-2020, 05:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB