ID:               41868
 Updated by:       [EMAIL PROTECTED]
 Reported By:      nick+phpbugs at ag dot arizona dot edu
-Status:           Assigned
+Status:           Bogus
 Bug Type:         PDO related
 Operating System: Linux
 PHP Version:      5.2.3
 Assigned To:      iliaa
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.


Previous Comments:
------------------------------------------------------------------------

[2007-07-02 19:51:53] jay at mysql dot com

This was unsupported behaviour and only worked by accident before
5.2.1.  Use bindValue() instead.  For more information, see here:

http://paul-m-jones.com/blog/?p=243

Cheers,

Jay

------------------------------------------------------------------------

[2007-07-02 05:10:28] nick+phpbugs at ag dot arizona dot edu

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.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=41868&edit=1

Reply via email to