Kevin Old am Mittwoch, 1. Februar 2006 13.44: > Hello everyone, > > I have a large chunk of data that I need to insert into a text or blob > field in mysql. I've tried all the usually escaping it, but nothing > seems to work. I'm even using dbh->quote as I thought it might help. > > Here's my code: > > my $sth = $dbh->prepare("insert into nascar_media values( > personal_characteristics ) (?)"); > $sth->execute( $dbh->quote($vals[13]) ); > > Not that it really helps, here's the DBD::mysql error returned: > > DBD::mysql::st execute failed: You have an error in your SQL syntax; > check the manual that corresponds to your MySQL server version for the > right syntax to use near '('\'Married: Arlene. Children: Amy > (10/14/72), Twins Rachel and Heather (10/31/7' at line 1 at ./nm4.pl > line 181.
The first single quote in the error msg is from the msg itself. The error occurs at the '('. So, your mysql syntax is wrong, independently from the inserted value. Just thest the statement at the mysal cmdline. Then, when using placeholders, quote() is not necessary; it's done automagically. I did not test it, but try the following (also note the missing field name 'personal_characteristics') - it is assumed that the table only consists of one field. $dbh->prepare( 'insert into nascar_media values (?)' ); $sth->execute( $vals[13] ); Check man DBI http://dev.mysql.com/ hth, joe -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>