|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56872 Prepared insert not inserting any values
Submitted: 2006-03-02 11:37 UTC Modified: 2006-04-11 10:48 UTC
From: kfbombar at us dot ibm dot com Assigned:
Status: Closed Package: PDO_ODBC (PECL)
PHP Version: 5.1.2 OS: Linux
Private report: No CVE-ID: None
 [2006-03-02 11:37 UTC] kfbombar at us dot ibm dot com
I found the following piece of code not working correctly.  It was run on SuSE Linux 32 connecting to a DB2 database.   It was run with PHP 5.1.2, and the pdo_odbc 1.0.  This same issue causes an error in ext/pdo/tests/pdo_021.phpt.  Please let me know if you need any further information.

Reproduce code:
$conn = new PDO('odbc:nodename', 'user', 'pass');
$conn->exec('DROP TABLE test');
$conn->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val0 VARCHAR(10), val1 VARCHAR(16))');
$select = $conn->prepare('SELECT COUNT(id) FROM test');
$data = array(
  array('0', 'Aa', 'aA'),
  array('1', 'Bb', 'bB'),
$stmt = $conn->prepare("INSERT INTO test VALUES(?, ?, ?)");
foreach ($data as $row) {
$num = $select->fetchColumn();
echo 'There are ' . $num . " rows in the table.\n";

Expected result:
There are 2 rows in the table.

Actual result:
There are 0 rows in the table.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-11 10:48 UTC] kfbombar at us dot ibm dot com
This bug has also been fixed with the most up to date build of PHP.  Thanks!
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun May 16 06:01:23 2021 UTC