on Tue, 01 Oct 2002 17:55:21 GMT, Jessee Parker wrote:

>     I'm a bit confused on why this is happening and I'm hoping
>     someone can 
> shed some light on things for me. I read in information from a file
> which is comma delimted and I use the parsing routine I found in the
> Perl Cookbook. When it hits a name with " marks around it, it shifts
> everything over when doing the insert. I have put escape characters
> in the data before insertion for both quotes and apostrophes and when
> I run it with w single entry, it inserts correctly. When run on a
> longer list, the line that has the name in quotes shifts everything
> over by one during the insertion. I'm using MySQL as the database.
> Thanks in advance! 

Use placeholders and your quoting troubles will be over forever ;-)

E.g.:

    my $sql = "INSERT INTO atable VALUES (NULL, ?, ?)";
    my $sth = $dbh->prepare($sql);
    $sth->execute($a_var, $another_var_with_embedded_quotes);

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to