note 20561 deleted from function.mysql-insert-id by sander
| From: | sander@php.net | Date: | Sat, 18 May 2002 07:17:24 +0000 |
| Subject: | note 20561 deleted from function.mysql-insert-id by sander | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-30796@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