PHP 4.0 Bug #10138 Updated: mysql_insert_id() returns incorrect value
| From: | jules at acris dot co dot uk | Date: | Tue, 03 Apr 2001 17:14:58 +0000 |
| Subject: | PHP 4.0 Bug #10138 Updated: mysql_insert_id() returns incorrect value | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-50717@lists.php.net to get a copy of this message | ||
ID: 10138
User Update by: jules@acris.co.uk
Old-Status: Closed
Status: Open
Bug Type: MySQL related
Description: mysql_insert_id() returns incorrect value
Previous Comments:
---------------------------------------------------------------------------
[2001-04-03 11:25:53] rasmus@php.net
I tested on 2 boxes using your exact script. Works perfectly. If this was broken thousands of
scripts out there wouldn't work. Check that your libmysqlclient version matches your mysql
server version.
---------------------------------------------------------------------------
[2001-04-03 11:20:56] jules@acris.co.uk
Example script:
mysql> use test;
mysql> create table mytable (a int primary key auto_increment, b int, c int);
<?php
mysql_connect("localhost","root","bannerjee");
mysql_select_db("test");
mysql_query("insert into mytable values (null, 5, 6)");
echo mysql_insert_id();
$res = mysql_query("select last_insert_id()");
$row = mysql_fetch_row($res);
echo "<BR>$row[0]";
?>
Example output:
722
8
Mysql 2.23.33; using the library provided with mysql (ie configure --with-mysql=/usr).
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=10138