|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-07-08 18:36 UTC] iliaa@php.net
[2005-07-08 19:02 UTC] matthew_peters at uk dot ibm dot com
[2005-07-08 21:27 UTC] wez@php.net
[2005-07-11 14:00 UTC] matthew_peters at uk dot ibm dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
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.