Id of last 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: Id of last insert (/showthread.php?tid=20432) |
Id of last insert - El Forum - 07-09-2009 [eluser]sherwoodforest[/eluser] I tried $insert_id = $this->db->insert('change',$data); but all I get back is 1 for the insert_id what I want is the primary key for the row I just inserted Id of last insert - El Forum - 07-09-2009 [eluser]Dam1an[/eluser] You need to use Code: $this->db->insert_id(); (I'm assuming you probably get 1 back meaning success, and 0 would mean it failed?) Id of last insert - El Forum - 07-09-2009 [eluser]sherwoodforest[/eluser] thank you |