CodeIgniter Forums
SOLVED: How can i use $this->db->insert in CI4? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: SOLVED: How can i use $this->db->insert in CI4? (/showthread.php?tid=81998)



SOLVED: How can i use $this->db->insert in CI4? - seighth - 06-01-2022

THIS PROBLEM IS ALREADY SOLVED AND HERE IS HOW I SOLVED IT:


Code:
$db = \Config\Database::connect();
$db->table('table_name')->insert($array));


____________________________________________________________________
Quote:as the title says, I would like to know what is the CI4 version of this because I am using my own MySQL query and not the built in feature of CI4... I have soo many Models from a previous project coming from CI3 that is why I wouldn't want to rewrite all those into CI4 built in Query Builder, I just want to know what is the equivalent version of $this->db->insert('tbl_name', $array) in CI4?