#39218 [Opn->Fbk]: parameter substitution:parameters always empty
| From: | tony2001@php.net | Date: | Fri, 20 Oct 2006 21:46:40 +0000 |
| Subject: | #39218 [Opn->Fbk]: parameter substitution:parameters always empty | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-103827@lists.php.net to get a copy of this message | ||
ID: 39218
Updated by: tony2001@php.net
Reported By: jan_metzel at gmx dot de
-Status: Open
+Status: Feedback
Bug Type: PDO related
Operating System: Linux
PHP Version: 5.1.6
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
Works just fine here.
Previous Comments:
------------------------------------------------------------------------
[2006-10-20 18:15:50] jan_metzel at gmx dot de
Description:
------------
Parameter substitution in PDO::prepare() does not work.
Statement has been executed successfully but it seems like
values of parameters are just empty strings.
Seems to occure no matter what kind of query is used
(SELECT, INSERT, DELETE, ...).
gentoo-linux ~x86
gcc-4.1.1
mysql-4.1.21
apache-2.0.59
php-5.1.6 (r6) (gentoo)
php5.2-200610201630 (php.net snapshot)
Strange:
On an other box with almost the same software the bug does
not occure (gcc-3.4.3 (!), mysql-4.1.21, apache-2.0.59,
php-5.1.6 (r6))
Reproduce code:
---------------
<?php
$conn = new PDO('mysql:host=localhost;dbname=test', 'root',
'extremlysecret');
$conn->query('CREATE TABLE IF NOT EXISTS
dummy (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
foo VARCHAR( 64 ) NOT NULL
) ENGINE = MYISAM');
$ps = $conn->prepare("INSERT INTO dummy (foo) VALUES (?)");
$ps->execute(array('first try'));
$ps = $conn->prepare("INSERT INTO dummy (foo) VALUES (:val)");
$val = 'second try';
$ps->bindParam(':val', $val);
$ps->execute();
$ps = $conn->exec("INSERT INTO dummy (foo) VALUES ('this is lame but
works')");
print_r($conn->query('SELECT * FROM
dummy')->fetchAll(PDO::FETCH_OBJ));
?>
Expected result:
----------------
Array
(
[0] => stdClass Object
(
[id] => 1
[foo] => first try
)
[1] => stdClass Object
(
[id] => 2
[foo] => second try
)
[2] => stdClass Object
(
[id] => 3
[foo] => this is lame but works
)
)
Actual result:
--------------
Array
(
[0] => stdClass Object
(
[id] => 1
[foo] =>
)
[1] => stdClass Object
(
[id] => 2
[foo] =>
)
[2] => stdClass Object
(
[id] => 3
[foo] => this is lame but works
)
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39218&edit=1