PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB2 » Bug #8130

LAST_INSERT_ID() issue

Details

Submitted2006-07-06 18:59 UTC
Fromerwann212 at gmail dot com
StatusBogus
PackageMDB2
PHP Version5.1.4
OSwinXP Home
Roadmaps(Not assigned)

Comments

[2006-07-06 18:59 UTC] erwann212 at gmail dot com

Description:
------------
LAST_INSERT_ID() seems to cause an error with mysql5.
I'm not sure this is a bug. It may be related to http://pear.php.net/bugs/bug.php?id=8051

Test script:
---------------
http://www.esnips.com/web/erwann-reports

2 files:
test_lastinsertid.php
test_lastinsertid.sql

Expected result:
----------------
"So far, it is working"

Actual result:
--------------
MDB2 Error: Array

[2006-07-18 18:47 UTC] erwann212 at gmail dot com

LAST_INSERT_ID() should be replaced by null value.
see http://lists.mysql.com/mysql/198870

"If you are going to specify values for all columns in your insert, you should put NULL as
the value for an AUTO_INCREMENT column, e.g.
mysql> insert into SalesSupData values (NULL,2,2,'test',140);

My preferred way however is to put the column names and just miss out the auto_increment
column:
mysql> insert into SalesSupData(ClientId, SupTypeId, Description, UserId) values
> (2,2,'test',140);
"