Jump to content


Photo

Problem with single quotes in mysql


  • Please log in to reply
1 reply to this topic

#1 mwouters

mwouters
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 20 July 2006 - 02:08 PM

Hello,

When I insert a word in mySQL which contains a single quote, I escape it using addslashes($word);

When I do an export of my database I get this:

VALUES (2, 'kleuter', 'Gods\\'' dienst',

When I try to get it out of the database I don't get any results using:

SELECT * FROM `uitgaven` WHERE leermiddel='Gods\' dienst'

It looks like mysql escapes the \ and the quote seperately???

How can I get this to work?

Thanks a lot!

Mark.

#2 ChaosXero

ChaosXero
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 20 July 2006 - 02:44 PM

Try using mysql_real_escape_string on your variables when you insert them, instead of addslashes.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users