Bug #63361 Unable to execute SQL queries with string values in single quotes(').
Submitted: 21 Nov 2011 15:43 Modified: 25 Jul 2014 20:13
Reporter: william foss Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.55 OS:Windows (Windows 7)
Assigned to: CPU Architecture:Any

[21 Nov 2011 15:43] william foss
Description:
Upgraded to MySQL 5.1.55(both client and server) and PHP 5.3.6 on my Yahoo! small business site.  Attempted to run this query in MySQL against my DB:

SELECT * FROM Inventory WHERE ItemStatus = 'Sold';.

The "\" in the error appear to be added by MySQL. When I select the "Back" link to edit the query, the "\" remain.  

Received the following error:
-------
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unclosed quote @ 46
STR: '
SQL: SELECT * FROM `Inventory` WHERE ItemStatus = \'Sold\';

SQL query:  

SELECT * FROM `Inventory` WHERE ItemStatus = \'Sold\'; 

MySQL said:  

#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 '\'Sold\'' at line 1 
------
Contacted support at Yahoo!.  I was eventually informed that the current version of MyPHPAdmin(2.11.9.6) is not completely compatible with MySQL 5.1.55
After some effort to correct this issue by altering my privileges(with no affect), I asked the support tech to roll me back to MySQL 4.  This was done for the server piece, but not for the client piece.  The client version is still 5.1.55.  There are efforts underway to supply the new version of MyPHPAdmin(3.4.7.1) as part of the upgrade to MySQL 5.  This will not occur until January 2012. Keep in mind, I was able to perform back end scripting 
and maintenance on my DBs using MySQL 4 with no issues.  Also the website is working fine.  I have queries in my PHP logic that are similar to the one I executed on the back end.  Thank you for your assistance and insight.

How to repeat:

Perform a SQL query using a string parameter in the WHERE clause.

Generally:

SELECT * FROM "TABLE" WHERE "COLUMN" = 'ANY STRING';

Specifically:

SELECT * FROM Inventory WHERE ItemStatus = 'Sold';
[21 Nov 2011 16:13] Valeriy Kravchuk
What exact client you had used to execute that query? Will you get the same problem when the same query is executed from mysql command line client? 

If you will not, I'd say that the bug is anywhere but NOT in MySQL server.
[22 Dec 2011 7:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[5 Jun 2014 18:00] Amber H
I am also having trouble running queries with where conditions equal to string variables. It works fine for integer values etc but not strings.
On Yahoo Small Business Web Hoster.
MySQL Server version: 5.1.55
phpMyAdmin - 2.11.9.6

When using single quotes, I get this error.
" MySQL said: Documentation
#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"

When I exclude the quotes it just gives me an empty set.
None of this is useful.
[25 Jul 2014 20:13] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

You use third-party clients which created by teams which are independent from MySQL team at Oracle. Please report bug to client's websites.