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

@imabot: If that's in the model? For the primary database? If so, you need to configure your model first:
https://codeigniter.com/user_guide/model...your-model

You don't need to use $this->table.

You just do:
Code:
$this->orderBy('id', 'DESC');
$this->orderBy('timestamp', 'DESC');
$this->where('field', $field);
$sqlQuery  = $this->get();
return $sqlQuery->getResult();
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 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 jreklund - 05-10-2020, 08:47 AM
RE: CI4 where should I connect to DB? - by imabot - 05-11-2020, 09:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB