ID: 38178 Updated by: [EMAIL PROTECTED] Reported By: gerald at copix dot org -Status: Open +Status: Assigned Bug Type: PDO related Operating System: Windows PHP Version: 5.1.4 -Assigned To: +Assigned To: wez
Previous Comments: ------------------------------------------------------------------------ [2006-07-21 16:08:00] gerald at copix dot org Description: ------------ Using PDO, a simple insert query does not work with "prepare / execute" but works fine using "exec" This exact query does work correctly if I remove the text '\r\n' at its end. The query is : 'INSERT INTO myTable VALUES (\'xml:lang="fr" lang="fr">\r\n\')' It may be related to the following bugs : #36923 & #37646 Reproduce code: --------------- //FOLLOWING DOES NOT WORK $stmt = $pdo->prepare ('INSERT INTO myTable VALUES (\'xml:lang="fr" lang="fr">\r\n\')'); if (! $stmt->execute ()){ print_r ($stmt->errorInfo ());//contains Array ( [0] => HY093 ) } //FOLLOWING CODE IS OK (using exec) if (! $pdo->exec ('INSERT INTO myTable VALUES (\'xml:lang="fr" lang="fr">\r\n\')')){ print_r ($pdo->errorInfo ()); } //FOLLOWING CODE IS OK (removed \r\n at the end of the query) $stmt = $pdo->prepare ('INSERT INTO myTable VALUES (\'xml:lang="fr" lang="fr">\')'); $stmt->execute ();//OK Expected result: ---------------- PDO should insert the value 'xml:lang="fr" lang="fr">\r\n' in the myTable table, wish is CREATE TABLE `myTable` ( `test` VARCHAR( 255 ) NOT NULL ) Actual result: -------------- Warning: PDOStatement::execute() [function.PDOStatement-execute]: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound in C:\Program Files\wamp\www\test_3\www\index.php on line 40 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38178&edit=1