![]() |
Newbie Q: Show newly inserted data. - 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: Newbie Q: Show newly inserted data. (/showthread.php?tid=23615) |
Newbie Q: Show newly inserted data. - El Forum - 10-16-2009 [eluser]Unknown[/eluser] Code: function event_insert() So I have this function that will insert a row into the database. And I want to immediately redirect the user to a page displaying the info he just submitted. Is there any easy way to do this without writing specific SQL queries? I want to get the "id" of the row I just inserted so I can add it to the redirect link, so the show page displays the info in that row. The "id" field is the primary key that auto-increments in the in table "events". Newbie Q: Show newly inserted data. - El Forum - 10-16-2009 [eluser]CroNiX[/eluser] Just get the last insert id. redirect('events/show/' . $this->db->insert_id() ); Newbie Q: Show newly inserted data. - El Forum - 10-16-2009 [eluser]Unknown[/eluser] That was exactly what I was looking for, thanks so much! |