Very Simple Auth Helper |
PHP Code: <?php Learning CI4 from my works, from errors and how to fix bugs in the community Love CI & Thanks CI Teams
Very simple indeed! Folks looking for a functional approach will probably appreciate this.
One recommendation: check out the framework guidelines for Authentication extensions: https://codeigniter4.github.io/CodeIgnit...ation.html Following these ensures that developers can build on common expectations for Authentication that are not specific to one package.
(10-16-2020, 06:35 AM)MGatner Wrote: Very simple indeed! Folks looking for a functional approach will probably appreciate this. Thanks @MGatner Learning CI4 from my works, from errors and how to fix bugs in the community Love CI & Thanks CI Teams
Instead of using getResult(); which is for multiple records use getRow(); single record.
You could also use $this->db->countAllResults(); Instead of count(); What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(10-19-2020, 06:02 AM)InsiteFX Wrote: Instead of using getResult(); which is for multiple records use getRow(); single record. - 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 |
Welcome Guest, Not a member yet? Register Sign In |