|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-05-10 10:03 UTC] uw@php.net
-Status: Open
+Status: Bogus
[2011-05-10 10:03 UTC] uw@php.net
[2011-05-10 17:58 UTC] contato at andersonfraga dot net
[2011-05-11 11:05 UTC] johannes@php.net
[2011-05-11 13:22 UTC] contato at andersonfraga dot net
[2012-06-26 11:56 UTC] baptx dot is at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 09:00:02 2025 UTC |
Description: ------------ This error is occurring when I use the same parameter several times in the query. In PHP 5.2.14, using Gentoo, it works perfectly. Already in versions 5.3.0 and 5.3.3 (using Windows on both), returns an exception. Bug or 'feature'? Test script: --------------- <?php try { $dbh = new PDO('mysql:/*irrelevant*/', Array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_EMULATE_PREPARES => false, )); $select = "SELECT * FROM PR_CLIENTE WHERE DELETADO = 'N' AND (NOME_CLIENTE LIKE :hash_1 OR ENDERECO_CLIENTE LIKE :hash_1) ORDER BY ID_CLIENTE DESC LIMIT :hash_2;"; $statement = $dbh->prepare($select); $statement->execute(Array( ':hash_1' => '%Anderson%', ':hash_2' => 0, )); $fetch = $statement->fetchAll(PDO::FETCH_ASSOC); print_r($fetch); } catch(PDOException $e) { print_r($e->getMessage()); } ?> Expected result: ---------------- Array ( [0] => Array ( [ID_CLIENTE] => 29 (...) ) ) Actual result: -------------- SQLSTATE[HY093]: Invalid parameter number