Welcome Guest, Not a member yet? Register   Sign In
Active Record Return Result Object on Insert/Update?
#2

[eluser]WanWizard[/eluser]
In the CI active record class the 'write' type queries all return TRUE if they succeed.

There is no real way to get the last inserted record. Some databases have engine specific workarounds for that. For MySQL, you could retrieve it using the insert_id, but that requires a table with an auto_increment column, and a known name for that column.

For updates, it's a bit easier, since you have the table and the where clause ( they are both parameters of $this->db->update() ), so you could use the same to run a select with those parameters after an update.


Messages In This Thread
Active Record Return Result Object on Insert/Update? - by El Forum - 08-26-2010, 01:22 PM
Active Record Return Result Object on Insert/Update? - by El Forum - 08-26-2010, 01:47 PM
Active Record Return Result Object on Insert/Update? - by El Forum - 08-26-2010, 01:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB