note 82367 added to function.mysql-insert-id
| From: | elinor dot hurst at REMOVETHIS dot gmail dot com | Date: | Tue, 08 Apr 2008 14:27:48 +0000 |
| Subject: | note 82367 added to function.mysql-insert-id | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138020@lists.php.net to get a copy of this message | ||
I don't get all the fuss around this.
I read:
"The value of mysql_insert_id() is affected only by statements issued within the current client
connection. It is not affected by statements issued by other clients."
See: http://dev.mysql.com/doc/refman/5.0/es/mysql-insert-id.html
I can't really see what's inaccurate about that.
"In the case of a multiple-row INSERT statement, mysql_insert_id() returns the first
automatically generated AUTO_INCREMENT value; if no such value is generated, it returns the last
last explicit value inserted into the AUTO_INCREMENT column."
I must be missing something here but why would you insert multiple rows and then only handle the
last one with some favoured behaviour? You could just as well insert them one at a time and then
handle each row separately with the latest id.
I can't see what's wrong with that.
However I can see what's wrong with simply using max(my_table.id_column) because of the
concurrent access issues this would imply.
----
Server IP: 69.147.83.197
Probable Submitter: 80.200.253.235
----
Manual Page -- http://www.php.net/manual/en/function.mysql-insert-id.php
Edit -- https://master.php.net/note/edit/82367
Del: integrated -- https://master.php.net/note/delete/82367/integrated
Del: useless -- https://master.php.net/note/delete/82367/useless
Del: bad code -- https://master.php.net/note/delete/82367/bad+code
Del: spam -- https://master.php.net/note/delete/82367/spam
Del: non-english -- https://master.php.net/note/delete/82367/non-english
Del: in docs -- https://master.php.net/note/delete/82367/in+docs
Del: other reasons-- https://master.php.net/note/delete/82367
Reject -- https://master.php.net/note/reject/82367
Search -- https://master.php.net/manage/user-notes.php