I am getting an error whenever the text string contains a single quote. Is there any module in PERL to handle this... or do you think i should just check for the single quote within each string and replace it with \'
thanks,
Scott
Yep, the DBI module can handle this for you, using the 'quote' function. EG:
[perl]
$dbh=DBI->connect('DBI:mysql:my_db:my_host', 'username', 'password');
$string=$dbh->quote("$string");
my $squery='INSERT into my_table (column) values ($string)';
my $sql=$dbh->prepare($squery);
$sql->execute;
$dbh->disconnect;
[/perl]
It's important to note that the quote() function will add the necessary quote marks to the string as well as escaping any special characters in there, so you don't need to include any quote marks in your SQL query.