Welcome Guest, Not a member yet? Register   Sign In
CI4 where should I connect to DB?
#4

$this->db are already initialized in Model, no need to connect again. Only if you don't want to extend the "helper" model created for you.
https://codeigniter.com/user_guide/model...l-creation

You can also use all function from the query builder directly.

You don't need to do:
Code:
$this->db->countAll();

You can do:
Code:
$this->countAll();
Reply


Messages In This Thread
CI4 where should I connect to DB? - by imabot - 05-07-2020, 11:32 PM
RE: CI4 where should I connect to DB? - by jreklund - 05-08-2020, 08:25 AM
RE: CI4 where should I connect to DB? - by imabot - 05-09-2020, 10:49 PM
RE: CI4 where should I connect to DB? - by imabot - 05-10-2020, 05:46 AM
RE: CI4 where should I connect to DB? - by imabot - 05-11-2020, 09:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB