|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-01-05 15:34 UTC] andrew at ajohnstone dot com
Description: ------------ databaseException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens Can't handle commented out lines with bound params Reproduce code: --------------- SELECT * FROM mapping_outlets mo JOIN media_outlets USING(mapping_outlets_id) WHERE -- mo.mapping_outlets_id = ? mo.media_outlets_id = ? GROUP BY ml.name ORDER BY NULL LIMIT 500 Expected result: ---------------- Ignore the commented outline. Actual result: -------------- databaseException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 00:00:01 2025 UTC |
I can't reproduce it using sqlite. <?php $x = new pdo('sqlite::memory'); $x->query('create table if not exists foo (x int)'); $x->query('insert into foo values (1)'); $x->query('insert into foo values (2)'); $y = $x->prepare('select x from foo where -- x = ? x = ?'); var_dump($y->execute(array(2))); var_dump($y->fetch()); var_dump($y->errorInfo()); bool(true) array(2) { ["x"]=> string(1) "2" [0]=> string(1) "2" } array(1) { [0]=> string(5) "00000" }