PDO Invalid parameter number - parameters in comments
Today I encountered a bug (in PDO) I never saw before, but is kinda obvious when you think about it.
I got the following error:
Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters
The query I was using was similar to the following:
SELECT x FROM y WHERE -- CHECKING IF X = ? -- x = :y AND 1 = 2
Obviously I had more parameters and a longer query.
Why does it give me this error?