[eluser]Unknown[/eluser]
Code:
function event_insert()
{
$this->db->insert('events', $_POST);
redirect('events/show/1'); // I want to replace the 1 here
}
function show()
{
$data['query'] = $this->db->get_where('events',array('id'=> $this->uri->segment(3) ));
$this->load->view('events/show', $data);
}
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".