Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 02-16-2004, 12:25 PM   #1
LQ Newbie
Registered: Sep 2003
Posts: 14

Rep: Reputation: 0
Using escape string error in MySQL select command, any one can help me?

Using escape string error in MySQL select command, any one can help me?


when I using the following select command, the syntax error appears.

select * from tablename where name like \'Mecki\' ;

what is going on? who can tell me why? thanks for your helping in advance.

Old 02-16-2004, 01:06 PM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
Well with your select command there, I really don't see a reason why you need the \ 's in there?

Can't you do the same select with something like this:

select * from tablename where name like 'Mecki' ;
Old 02-16-2004, 10:20 PM   #3
LQ Newbie
Registered: Sep 2003
Posts: 14

Original Poster
Rep: Reputation: 0

I am writing a PHP + MySQL web script. I use a <input type=text ....> to collect the select command in the web client, when the form posted, the punctuation ' will escaped as \' automatically. I don't know how to unescape the \' in PHP. if I use the escaped punctuation \' , the select syntax error will appear.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
escape string in bash script so it can be used in command line BuckRogers01 Linux - Software 15 08-12-2010 10:38 AM
passing escape characters along with lp command zita Linux - General 0 10-05-2005 02:58 PM
MySQL select command denied to user error lsimon4180 Linux - Software 2 03-03-2005 07:34 PM
Handle escape characters in a string Helene Programming 7 05-02-2004 12:43 AM
How do I escape mysql RPM erase deadlock ?? tuka Linux - Newbie 1 09-06-2003 11:54 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration