You are here:  » Apostrophe's in CSV file cutting off mysql insert


Apostrophe's in CSV file cutting off mysql insert

Submitted by limestar on Tue, 2009-01-27 19:06 in

I've been using magicparser now with success on several db's this is the first time I've run into this problem. I'm guessing its some kind of setting that isn't right.

Essentially in a description field of the feed it would say: It's a nice day

and the insert script I made is dieing on the apostrophe in the word "It's".

Submitted by support on Tue, 2009-01-27 19:13

Hi,

Make sure you are using mysql_escape_string() when constructing your SQL - that should be all it is.... for example:

  $sql = "INSERT INTO table SET description='".mysql_escape_string($record["DESCRIPTION"])."'";

Hope this helps,
Cheers,
David.