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

(This post was last modified: 05-10-2020, 06:03 AM by imabot.)

Oops, it does not work :


Quote:You must set the database table to be used with your query.

Here is my code:
Code:
$builder = $this->table('tablename');
        $builder->orderBy('id', 'DESC');
        $builder->orderBy('timestamp', 'DESC');
        $builder->where('field', $field);
        $sqlQuery  = $builder->get();       
return $sqlQuery->getResult();


It only works with manual initialization. What am i doing wrong?
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 imabot - 05-11-2020, 09:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB