Transaction in controller throwing error - 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: Transaction in controller throwing error (/showthread.php?tid=76960) |
Transaction in controller throwing error - @nuj_3313 - 07-07-2020 Hi all, I want to use transaction in the controller but I am getting below error: Undefined property: App\Controllers\Product_Control::$db (Product_Control is my controller) My code is as below Code: $this->db->transBegin(); Am I doing anything wrong here.?... Please help me. RE: Transaction in controller throwing error - jreklund - 07-08-2020 You need to connect to the database: https://codeigniter.com/user_guide/database/connecting.html Code: $this->db = \Config\Database::connect(); |