Subject: mysql_real_escape_string for HTML <p>???

From: Date: Sun, 06 Mar 2005 11:27:14 +0000
Subject: Subject: mysql_real_escape_string for HTML <p>???
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-38783@lists.php.net to get a copy of this message
You actually need (it's in the manual) nl2br for this. It converts newline (nl) to (2) break (br) so this text (\n indicates a newline character or 'enter' as you've called it) This\n is\n a\n test\n Would become This<br />\n is<br />\n a<br />\n test<br />\n Make sure you strip those <br /> if you intend to put the content back in to a database though, or you'll double up the line count. Cheers - Neil At 04:47 06/03/2005 +0000, you wrote:
Message-ID: <003801c52203$f1235cc0$24fae2d1@ron> From: "Ron Piggott" <ron.php@actsministries.org> To: "PHP DB" <php-db@lists.php.net> Date: Sat, 5 Mar 2005 23:21:14 -0500 MIME-Version: 1.0 Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: 7bit Subject: mysql_real_escape_string for HTML <p>??? I know of the $variable = mysql_real_escape_string($variable); It works just nicely to allow some of the wild cards to be saved to a mySQL table. Is there something like this for HTML that when you retrieve from a variable in the table an ENTER would be converted to <P> I am mainly talking about when the variable is defined as "longtext" and you are expecting the user to write a few sentences or where they may s/he may press ENTER to start a new line. Ron
======================================================== CaptionKit http://www.captionkit.com : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player. VideoChat with friends online, get Freshly Toasted every day at http://www.fresh-toast.net : NetMeeting solutions for a connected world.

« previous php.db (#38783) next »