Subject: mysql_real_escape_string for HTML <p>???

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

 



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@xxxxxxxxxxxxxxxxxx>
To: "PHP DB" <php-db@xxxxxxxxxxxxx>
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.

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux