Damn, that's a mouthful. Hopefully someone understands it ;) I'm writing a script to take an existing data source (tab delimeted text file exported from Word doc w/ table) and insert the data into a MySQL DB using DBI. My problem is that some of the fields are either quoted ("") or have apostrophes ('), so I can't quote the data in the query without something fouling up (MySQL chokes on the query because of the weird quoting). Can someone help?

$dbh->do("INSERT INTO people VALUES(NULL, '$parts[1]', '$parts[2]', '$parts[3]', ....");

Example:

INSERT INTO people VALUES(NULL, "Firstname", "Lastname", ""123 Anywhere Address"", 
...");
INSERT INTO people VALUES(NULL, "Firstname", "Lastname", '123 O'Walley Street', ...");

See the problem? I can't use either quoting consistently due to the nature of the data I'm working with.

--
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.
636-357-1548


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to