Welcome Guest, Not a member yet? Register   Sign In
it is save use $this->db->insert_id() ?
#1

[eluser]atoleon[/eluser]
I need to insert a new item in my database, but i need to get the id of this item inmediatelly.
I have seen the $this->db->insert_id() function, but i dont know if is it save use it.
what would happen if userA insert an item and before execute the insert_id() funcion, an userB insert another item. It is possible if there are a lot of users writing at the same time.

thank you
#2

[eluser]TheFuzzy0ne[/eluser]
Yes, it's safe to use. $this->db->insert_id() will return the insert ID of the last inserted row by the currently executing script. It is not affected by other requests.
#3

[eluser]atoleon[/eluser]
Thank you




Theme © iAndrew 2016 - Forum software by © MyBB