note 20561 added to function.mysql-insert-id
| From: | tom at daemond dot com | Date: | Mon, 08 Apr 2002 11:57:44 +0000 |
| Subject: | note 20561 added to function.mysql-insert-id | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-28949@lists.php.net to get a copy of this message | ||
mysql_insert_id() in php is different from LAST_INSERT_ID() in mysql.
// in php:
$result=mysql_query("INSERT INTO table SET uid=1123");
echo mysql_insert_id();
// this will echo 1123
// the same thing in mysql
#> mysql
USE test
INSERT INTO table SET uid=1123;
SELECT LAST_INSERT_ID();
// this will return zero, or wrong value
--
http://www.php.net/manual/en/function.mysql-insert-id.php
http://master.php.net/manage/user-notes.php?action=edit+20561
http://master.php.net/manage/user-notes.php?action=delete+20561
http://master.php.net/manage/user-notes.php?action=reject+20561