in reply to Re: Re: Escaping a string
in thread Escaping a string

If you are using DBI to access MySQL then something like this may be better.

use DBI; my $dbh=DBI->connect('DSN info here'); my $string="D'ith"; my $val_to_put_in_mysql=$dbh->quote($string);

Or if you are using placeholders in your query then DBI will do the quote on insert for you. Either way DBI will fetch it back as D'ith for you.