![]() |
Query - Call to undefined method CodeIgniter\Database\MySQLi\Connection::where() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Query - Call to undefined method CodeIgniter\Database\MySQLi\Connection::where() (/showthread.php?tid=71872) |
Query - Call to undefined method CodeIgniter\Database\MySQLi\Connection::where() - happyape - 10-04-2018 I get this error "Call to undefined method CodeIgniter\Database\MySQLi\Connection::where()" when I try this in my model class PHP Code: $this->db->table($table); however it works fine when PHP Code: $this->db->table($table)->where($where)->update($save_data); The first approach above worked fine in CI 3. So I suppose in CI 4 I just to have chain or save $db = $this->db; RE: Query - Call to undefined method CodeIgniter\Database\MySQLi\Connection::where() - unodepiera - 10-04-2018 (10-04-2018, 01:22 AM)happyape Wrote: I get this error "Call to undefined method CodeIgniter\Database\MySQLi\Connection::where()" when I try this in my model class This works like says the documentation: Model.php PHP Code: public function updateData (int $id = 1) { RE: Query - Call to undefined method CodeIgniter\Database\MySQLi\Connection::where() - titounnes - 10-04-2018 (10-04-2018, 04:40 AM)unodepiera Wrote:In CI-4, you can write more simply.(10-04-2018, 01:22 AM)happyape Wrote: I get this error "Call to undefined method CodeIgniter\Database\MySQLi\Connection::where()" when I try this in my model class In conttroler PHP Code: $data = [ In Model PHP Code: <?php RE: Query - Call to undefined method CodeIgniter\Database\MySQLi\Connection::where() - unodepiera - 10-04-2018 (10-04-2018, 01:22 AM)happyape Wrote: I get this error "Call to undefined method CodeIgniter\Database\MySQLi\Connection::where()" when I try this in my model class A great explanation of Lonnie about this question. RE: Query - Call to undefined method CodeIgniter\Database\MySQLi\Connection::where() - happyape - 10-04-2018 Yes that makes sense! Thx |