note 8575 added to nl2br

From: Date: Mon, 18 Sep 2000 08:20:39 +0000
Subject: note 8575 added to nl2br
Groups: php.notes 
Request: Send a blank email to php-notes+get-5167@lists.php.net to get a copy of this message
I was running into /n problems too. I have forms with textarea (for adresses) that should be inserted into a mysql table. I uses nl2br to manipulate the string before inserting it. It seemed to work fine, I could do a select and the results looked the way they should. But when I looked at the tables from the command prompt (mysql>) they looked UGLY, because there was still the \r command left in the string or whatever. So the only way to solve it was <pre> $text = nl2br(text); $text = ereg_replace("\n", "", $text); $text = ereg_replace("\r", "", $text); </pre> Messy, I know, but it works. Jan. http://www.php.net/manual/function.nl2br.php

« previous php.notes (#5167) next »