|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-01-14 23:54 UTC] johannes@php.net
-Status: Open
+Status: Duplicate
[2013-01-14 23:54 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 13:00:01 2025 UTC |
Description: ------------ I have a table with two varchar fields: create table test( a varchar, b varchar ); When I execute an insert query where the following conditions are met: - the first field contains a string like this \\''a - the second field containts a ? character - the PDO attribute PDO::ATTR_EMULATE_PREPARES is passed to PDO::prepare method I get the following error: Invalid parameter number: no parameters were bound in php shell code on line 1 I don't know if the problem is bound to postgresql databases only or other ones. Test script: --------------- $db = new PDO("pgsql:host=localhost;port=5432;dbname=test;"); $sql = "insert into test values ('\\''a','?')"; $res = $db->prepare($sql,array(PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT => 1)); $res->execute(); Expected result: ---------------- The query should be executed correctly Actual result: -------------- Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: no parameters were bound in php shell code on line 1