Edit report at http://bugs.php.net/bug.php?id=48877&edit=1
ID: 48877
Comment by: ssufficool at gmail dot com
Reported by: siegmar at siegmar dot com dot br
Summary: "bindValue" and "bindParam" do not work for PDO
Firebird
Status: Open
Type: Bug
Package: PDO related
Operating System: Windows
PHP Version: 5.2.10
New Comment:
Try changing the :empno to just empno in bind* it is not expected or
needed:
$command = $connection->prepare('SELECT EMP_NO FROM EMPLOYEE WHERE
EMP_NO = :empno');
$command->bindParam('empno', $value, PDO::PARAM_STR); // does not work
$command->bindValue('empno', $value, PDO::PARAM_STR); // does not work
Previous Comments:
------------------------------------------------------------------------
[2009-07-10 02:35:29] siegmar at siegmar dot com dot br
Description:
------------
The "bindValue" and "bindParam" do not work for PDO Firebird if we use
named parameters (:parameter) but do work for question marks parameters
(?).
Reproduce code:
---------------
<?php
$connection = new
PDO('firebird:dbname=localhost:C:\Firebird\EMPLOYEE.FDB', 'SYSDBA',
'masterkey');
$value = '2';
//$command = $connection->prepare('SELECT EMP_NO FROM EMPLOYEE WHERE
EMP_NO = :empno');
//$command->bindParam(':empno', $value, PDO::PARAM_STR); // does not
work
//$command->bindValue(':empno', $value, PDO::PARAM_STR); // does not
work
$command = $connection->prepare('SELECT EMP_NO FROM EMPLOYEE WHERE
EMP_NO = ?');
$command->bindParam('1', $value, PDO::PARAM_STR); // works
//$command->bindValue('1', $value, PDO::PARAM_STR); // works
$command->execute();
$dataset = $command->fetchAll();
foreach($dataset as $record)
echo $record[0] . "<br />";
?>
The same code works perfectly for MySQL.
Expected result:
----------------
Using the example database "EMPLOYEE.FDB" you sould see:
2
Actual result:
--------------
nothing
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=48877&edit=1