I want to prepare a string for mysql insert by handling a single quote

I have string with single quotes that I need to handle before inserting into mysql.

Quote examples are      hel'lo    or   hello'    or  'hello


How can I use a perl regex to add another single quote in front of the single quote within the string?

hel''lo
dmalovichAsked:
Who is Participating?
 
Dave BaldwinFixer of ProblemsCommented:
See here:  http://dev.mysql.com/doc/refman/5.0/en/string-literals.html   There is a link at the bottom of the page to Perl methods.
0
 
Dave BaldwinFixer of ProblemsCommented:
Two single quotes doesn't provide an escape sequence in MySQL.  It does work in Microsoft SQL Server / T-SQL.  Which one are you working with?
0
 
dmalovichAuthor Commented:
MySql
0
 
dmalovichAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.