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)


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:
From: "Ron Piggott" <[EMAIL PROTECTED]>
To: "PHP DB" <>
Date: Sat, 5 Mar 2005 23:21:14 -0500
MIME-Version: 1.0
Content-Type: text/plain;
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

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.


CaptionKit : 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 : NetMeeting solutions
for a connected world.

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to