PDA

View Full Version : SQL escape



bardic
September 5th, 2007, 12:49 PM
I'm trying to insert a row that looks like this:

INSERT INTO country VALUES ('CI','COTE D\'IVOIRE','Cote D\'Ivoire','CIV','384');

but no matter what I try it keeps spitting an error at me. How would I get sql to realize that I'm trying to escape to insert the ' .

kaykays
September 9th, 2007, 04:36 AM
Insert one such record containing text "COTE D'IVOIRE"
in Mysql manually using phpmyadmin.

Then export this record to see what statement you get.
That should work.

I got something like this:

INSERT INTO country VALUES ('CI','COTE D''IVOIRE','Cote D''Ivoire','CIV','384');