Welcome Guest, Not a member yet? Register   Sign In
Parallel INSERT operations possible conflicts using "$this->db->insert_id()"?
#11

[eluser]TheFuzzy0ne[/eluser]
Information on MySQLs LAST_INSERT_ID() function: http://dev.mysql.com/doc/refman/5.0/en/g...ue-id.html

It works almost identically to PHPs mysql_insert_id()
#12

[eluser]mindprojects[/eluser]
Now i can understand better,thanks...so in few words:
I open the php script where i have a connection to he database.The system assigns an unique conn_id to me so that whe i'm executing this function,and another user is doing the same,nothing would appen because we are acting on different connection ID? Right?

function insert_id()
{
return @mysql_insert_id($this->conn_id);
}
#13

[eluser]TheFuzzy0ne[/eluser]
Yes. That's pretty much what I've been trying to say. There are times when you may need to lock the database table, but getting the ID of the last inserted row isn't one of them.

I'm glad you understand better now, as my increased need for caffeine-based substances was starting to get expensive.
#14

[eluser]mindprojects[/eluser]
Great!Thanks again...having such a teacher for each problem would make my life easier....:-)




Theme © iAndrew 2016 - Forum software by © MyBB