|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-10-20 21:46 UTC] tony2001@php.net
[2006-10-21 12:24 UTC] jan_metzel at gmx dot de
[2006-10-21 20:38 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 19:00:01 2025 UTC |
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 ) )