Bug #60515 [Fbk->NoF]: PDO_MYSQL: "Invalid parameter number" although it is correct
| From: | php-bugs at lists dot php dot net | Date: | Tue, 15 Oct 2013 11:54:31 +0000 |
| Subject: | Bug #60515 [Fbk->NoF]: PDO_MYSQL: "Invalid parameter number" although it is correct | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-182198@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60515&edit=1
ID: 60515
Updated by: php-bugs@lists.php.net
Reported by: phoenixseve at freenet dot de
Summary: PDO_MYSQL: "Invalid parameter number" although it is
correct
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: PDO related
Operating System: archlinux x86_64
PHP Version: 5.3.8
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2013-06-12 02:14:52] ssufficool@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
I don't think the assoc array is supposed to include the ":"
try:
$stmt->execute(array('p0'=>'2', 'p1'=>'b2' ));
------------------------------------------------------------------------
[2012-09-17 20:55:02] phoenixseve at freenet dot de
You're right, using WHERE
id=24 works.
But the following query works on the command line client of MySQL:
mysql> UPDATE edtable SETid=1
mysql> WHERE id='24';
Query OK, 1 row affected (0.19 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Same is true for Postgres 9.1:
postgres=# UPDATE "edtable" SET "id"=1 WHERE "id"='24';
UPDATE 1
As I can read from http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html#operator_equal
id='24' is actually valid, at least in MySQL.
Who imposes the limitation that quotes are not valid here when using PDO?
------------------------------------------------------------------------
[2012-09-17 20:12:42] willfitch@php.net
After removing the invalid quote from your SQL statement, there is no issue here.
I tried this with MySQL and PostgreSQL drivers. Please confirm.
------------------------------------------------------------------------
[2012-05-02 11:21:11] uw@php.net
$stmt = $pdo->prepare("UPDATE edtable SET id=:p0,
coun't()= :p1 WHERE id='24'");
Your SQL is invalid.
Whatever is behind, parsing is done by the PDO core. Thus, this is most unlikely to be MySQL
specific. Parsing needs to be done as a syntax is used that is not supported by MySQL. Replace MySQL
here with any other DB that does not support named parameters or do the same with questionmarks and
a DB that does support named parameters only but no questionmarks.
------------------------------------------------------------------------
[2012-03-06 02:35:34] jeffvanb at u dot washington dot edu
This misleading error message is also thrown when you include a single-line
comment that contains a single-quote.
Example:
SELECT something
-- This valid SQL syntax shouldn't be a problem
FROM somewhere
WHERE value = :v;
PDO will tell you the parameter count is mismatched and you will pull your hair
out wondering what is wrong.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=60515
--
Edit this bug report at https://bugs.php.net/bug.php?id=60515&edit=1