testacct,
Monday, June 24, 2002, 3:37:37 PM, you wrote:

t> I am comparing songnames from two tables to find a match.
t> My query looks like this:

t> $querymvideo = "select movietable.id, movietable.songname
t> from movietable where TRIM(movietable.songname) LIKE
t> '__$foo' ";

t> The above query works fine except when a songname has the
t> single quote symbol: "'" or maybe it is the comma in the
t> song.  

t> Example song: 
t> I'll See the Light, Tonight

t> This gives an error:

t> Warning: Supplied argument is not a valid MySQL result
t> resource in /testing/dirlisting4e.php on line 208
t> MySQL error 1064: You have an error in your SQL syntax
t> near 'll See the Light, Tonight' ' at line 1........

t> How to escape or ignore the single quote: "'" in a
t> variable. Can I use the escape clause somehow in my query:
t> ESCAPE ''';
t> I am using PHP and MySQL

Yes, you should escape single quotes. By default escape character is
'\', keyword ESCAPE is used if you want to use other escape character
than '\'.

List of characters that should be escaped you can find at:
      http://www.mysql.com/doc/S/t/String_syntax.html
      
Take a look at addslashes() function in PHP.




-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to