What is the preferred way to insert strings that can contain both single and double quotes (",') into MySql using DBI? For example, $val1
and $val2
can contain quotes:
my $dbh = DBI->connect( ... );
my $sql = "insert into tbl_name(col_one,col_two) values($val1, $val2)";
my $sth = $dbh->prepare($sql);
$sth->execute();