Re: Carriage Returns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Nov 8, 2009 at 11:40 AM, John List <johnlist@xxxxxxxxxxxxxx> wrote:
> 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
>
>
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
It's probably worthwhile to note that nl2br does NOT replace \n and/or
\r with <br /> but rather puts a <br /> before the newline
character(s).  Try str_replace("\r", '', $post_field).

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux