Re: Carriage Returns
| From: | John List | Date: | Sun, 08 Nov 2009 16:40:55 +0000 |
| Subject: | Re: Carriage Returns | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-299698@lists.php.net to get a copy of this message | ||
Dan Shirah wrote:
Hello all, Basically I have a form with a <textarea>. The user can enter up to 5,000 characters in this text area. If the user just types text like: This is a test. And saves it, there's no problem. However if the user types: This Is A Test And saves it, the insert bombs. I've tried using nl2br($text) and str_replace("\r","#CR",$text) to convert the carriage returns, but it still crashes.I'm using an informix database and the column is: my_text CHAR(5000)Any ideas why it crashes any time there is a carriage return in the text area? Thanks, Dan João Cândido de Souza Neto wrote:
Are you using nl2br to convert before recording or after?This is probably an Informix problem or a problem with your interface to Informix. (I say that because I store textarea data with embedded newlines all the time in MySQL using the PHP mysql_ functions.) What interface are you using? ODBC? What errors do you get from Informix when it bombs? I'm guessing an embedded CR or LF character is breaking something as it's being passed to Informix. As João implies, if you really are changing these to break tags, you shouldn't have a problem. So you might try outputting the results of your conversion to your PHP error log before you pass it to Informix. You may find more help on an Informix list. John