[eluser]Chad Crowell[/eluser]
I have a working php/mssql/odbc CI install on 1.7.1. I'm just in the beginnings of a new app.
I've got this function in my controller that inserts a kit title into the db table and *should* return the unique ID from the table and allow me to redirect the user to the edit page for this new kit.
Here is the code:
Code:
function add() {
//grab the post
$kitname = $this->input->post('kitname');
if ($kitname != false) {
//put the kit into the db
$data = array(
'kitname' => $kitname
);
//perform the insert
$this->db->insert('kits', $data);
//get the new kit ID
$kit_id = $this->db->insert_id();
if ($kit_id) { //insert was successful
echo $kit_id;
//send the user to the edit form
redirect('kits/edit/'.$kit_id, 'refresh');
}
}
}
The insert is happening with no problems - I can see the new kit every time I test this when I go back to the kit listing page, but I am not seeing a $kit_id echoe'd to the add page and I am not being forwarded to the edit page (I realize I don't need a physical add page but i was using it for testing).
I did have to chase down a couple of bugs for the odbc driver for mssql but its been working great. Maybe related, though?