How to insert text into mysql having quotes using perl ?
It seems difficult to insert text containing ‘ & “.
I’m using Perl DBI module & DB is mysql.
UPDATE:
here is my query
my $s = "INSERT INTO comment(guid,review_id) VALUES ('$guid','$review_id')";
Your old query would have been something like this:
The better way, using placeholders and bind values as per @AlexD’s answer, would look like this:
To learn about the security risks of your first approach, have a look at SQL injection attacks on Wikipedia.