php.net |  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
Description:
------------
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) {
  $stmt->execute($row);
}
$select->execute();
$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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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-2020 The PHP Group
All rights reserved.
Last updated: Sat Nov 28 14:01:23 2020 UTC