two database insert operations in one function using $this->db->insert() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: two database insert operations in one function using $this->db->insert() (/showthread.php?tid=25592) |
two database insert operations in one function using $this->db->insert() - El Forum - 12-17-2009 [eluser]core-coder[/eluser] Hi all How can I perform two insert operations to two tables in a function ? I tried following code Code: $this->subproduct = $name; I am getting following error Quote:A Database Error Occurred How can I reset values in $this after first insertion ? Thanks two database insert operations in one function using $this->db->insert() - El Forum - 12-17-2009 [eluser]Cro_Crx[/eluser] You shouldn't really be using the current object to insert into the database, it would probably be better to use another variable. That way you can use two different ones for the inserts, for example Code: $data['subproduct'] = $name; You could use anything else instead of $data and $other_data two database insert operations in one function using $this->db->insert() - El Forum - 12-17-2009 [eluser]saidai jagan[/eluser] Yes this is Clean two database insert operations in one function using $this->db->insert() - El Forum - 12-18-2009 [eluser]core-coder[/eluser] Thanks guys |