On Wed, 26 Jun 2002, Ian Harisay wrote: > Date: Wed, 26 Jun 2002 14:57:45 -0600 > From: Ian Harisay <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED], [EMAIL PROTECTED] > Subject: Re: Insert won't accept apostrophes > > > use the quote method or a placeholder. > > > >>> "Emma Grant" <[EMAIL PROTECTED]> 06/26/02 02:31PM >>> > Hi,
I got in on this late: if you are talking about processing the result in a perl script then you can use $textarea = $dbh->quote($textarea); This will correctly "escape" the information before you put it into the update/insert statement. > > I am trying to insert a paragraph from a <textarea> field on a form. > This form is part of a CGI script that then inserts the textarea data > into a MySQL database table through DBI. The problem is that when the > paragraph contains an apostrophe, eg. 'The script won't work' then the > row will not insert and I get an error "You have an error in your SQL > syntax near 't at line ..." But if I do not put the apostrophe, it works > fine. In the insert statement I insert the data by using a variable > name, eg. '$textfield' not 'The script won't work' > > Is there an escape function that I can use on the variable name? or > maybe something else that I am missing? > > Thanks, > > Emma > > Sincerely, William Mussatto, Senior Systems Engineer CyberStrategies, Inc ph. 909-920-9154 ext. 27
