FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=16515&edit=1

ID: 16515
Updated by: l.alberton@quipo.it
Reported By: ben at imperialwebdesigns dot com
Summary: MDB2_Driver_mysql::lastInsertId(..) fails on php 5.3
-Status: Open
+Status: Closed
Type: Bug
Package: MDB2_Driver_mysql
Operating System: Windows 2003
Package Version: 1.4.1
PHP Version: 5.3.0
-Assigned To:
+Assigned To: quipo
Roadmap Versions:
New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: quipo
I tested the code in SVN with PHP 5.3.1 and cannot reproduce the bug.

Test script:

<?php
/*
CREATE TABLE bug16515 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
a CHAR(1)
);
*/

require_once 'MDB2.php';
$db =& MDB2::factory('mysql://root@localhost/test');
$sql = "INSERT INTO bug16515 (a) VALUES ('a')";
$db->query($sql);
var_dump($db->lastInsertId());


Previous Comments:
------------------------------------------------------------------------

[2009-08-11 22:23:37] microtrash

Description:
------------
The line return $this->queryOne('SELECT LAST_INSERT_ID()', 'integer');
in method MDB2_Driver_mysql::lastInsertId(..) fails under php 5.3
returning no ID. I hacked a working version for myself by replacing
that line with the following:


$result = $this->_doQuery("select last_insert_id()", true);
$row=mysql_fetch_array($result);
$ret=$row[0];
return $ret;

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedDec 27, '09 at 10:02p
activeDec 27, '09 at 10:02p
posts1
users1
websitepear.php.net

1 user in discussion

L Alberton: 1 post

People

Translate

site design / logo © 2022 Grokbase