#33618 [Opn->Fbk]: PDO LastInsertId() returns "%ld"

From: Date: Fri, 08 Jul 2005 16:36:41 +0000
Subject: #33618 [Opn->Fbk]: PDO LastInsertId() returns "%ld"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-81593@lists.php.net to get a copy of this message
ID: 33618 Updated by: iliaa@php.net Reported By: matthew_peters at uk dot ibm dot com -Status: Open +Status: Feedback Bug Type: PDO related Operating System: WinXP PHP Version: 5.1.0b2 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2005-07-08 18:31:22] matthew_peters at uk dot ibm dot com Description: ------------ Call to PDO LastInsertId() with the MySQL driver was working fine for me on 5.0.3 and 5.0.4 but is returning "%ld" with 5.1 b2. I am using just the php_pdo_mysql.dll extension that came with the 5.1 beta. Reproduce code: --------------- <?php $dbh = new PDO("mysql:dbname=COMPANYDB;host=localhost",'root','*******'); $stmt = 'INSERT INTO company (name) VALUES ("Acme");'; $pdo_stmt = $dbh->prepare($stmt); $rows_affected = $pdo_stmt->execute(); $last_insert_id = $dbh->lastInsertId(); echo $last_insert_id; // gets %ld ?> Expected result: ---------------- What I want to see is the primary key of the row I have just inserted. The database definition by the way is: create table company ( id integer auto_increment, name char(20), employee_of_the_month integer, primary key(id) ); Actual result: -------------- What I do see is %ld. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33618&edit=1

« previous php.bugs (#81593) next »