#33618 [NEW]: PDO LastInsertId() returns "%ld"
| From: | matthew_peters at uk dot ibm dot com | Date: | Fri, 08 Jul 2005 16:31:23 +0000 |
| Subject: | #33618 [NEW]: PDO LastInsertId() returns "%ld" | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-81592@lists.php.net to get a copy of this message | ||
From: matthew_peters at uk dot ibm dot com
Operating system: WinXP
PHP version: 5.1.0b2
PHP Bug Type: PDO related
Bug description: PDO LastInsertId() returns "%ld"
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 bug report at http://bugs.php.net/?id=33618&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33618&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33618&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33618&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33618&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33618&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33618&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33618&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33618&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33618&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33618&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33618&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33618&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33618&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33618&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33618&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33618&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33618&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33618&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33618&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33618&r=mysqlcfg