|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-07-02 19:51 UTC] jay at mysql dot com
[2007-07-03 23:42 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 14:00:01 2025 UTC |
Description: ------------ A named parameter should be able to be included more than once in a query, but bound only once. Instead, when code like the given is executed, the following error is produced: Warning: PDOStatement::execute() [function.PDOStatement-execute]: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in /home/njm/public_html/test.php on line 7 Reproduce code: --------------- $db = new PDO('mysql:host=localhost;dbname=test', 'test', 'whatever'); $db->exec('CREATE TABLE foo (a INT, b INT)'); $sth = $db->prepare('INSERT INTO foo (a, b) VALUES (:value, :value)'); $sth->bindParam(':value', 10); $sth->execute(); Expected result: ---------------- A row inserted into foo where a = b = 10.