A better solution would be to use the DBI quote() function, see the DBI
perldoc for more information.
and FYI 99% of web clients pass CRLF not just LF so you'd need \r\n
Chris Thompson wrote:
>
> > Trying to get text from a CGI textarea box to go into MySQL with the <br>
> > line breaks instead on generic \n breaks. Is there an easy way to parse
> the var
> > and make the necessary change?
>
> You can use a Perl regular expression. The following seems to work for me:
>
> # replace line breaks with HTML <BR> tags
> $textarea =~ s/\n/<BR>/g;
>
> Kind regards,
>
> Chris
>
> Waverley Internet Design
> http://www.waverley-internet.co.uk
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php