#36798 [Opn]: mysql error when using named parameters in a query with high ascii

From: Date: Mon, 20 Mar 2006 14:54:36 +0000
Subject: #36798 [Opn]: mysql error when using named parameters in a query with high ascii
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-94639@lists.php.net to get a copy of this message
ID: 36798 User updated by: albert at jool dot nl Reported By: albert at jool dot nl Status: Open Bug Type: PDO related Operating System: Debian Sarge PHP Version: 5.1.2 New Comment: Changing the single quotes in the query to double seems to fix the problem. Previous Comments: ------------------------------------------------------------------------ [2006-03-20 15:50:38] albert at jool dot nl Description: ------------ Create a PDO_MYSQL connection ($db in the example code). Prepare a query with high ascii values between single quotes (update queries are often affected) and one or more named parameters. Execute the query. Reproduce code: --------------- $query = " SELECT 'ï' as test FROM test WHERE id = :id"; $stm = $db->prepare($query); $stm->execute(array(":id" => 1)); Expected result: ---------------- No errors, query is correct when executed directly under mysql. Actual result: -------------- SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':id' at line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36798&edit=1

« previous php.bugs (#94639) next »