Forums

PHP

This topic is locked

text formatting with mysql

Posted 20 Nov 2002 14:42:49
1
has voted
20 Nov 2002 14:42:49 Adam Davies posted:
Ok the answer to this is probably going to be the easiest.

after ripping all my hair out I still can't work out how to keep the line breaks when I insert from a text box into mysql, im using dmx with the php model server, i know from previous answers that its easy in phakt but what about dmxs native php.

this is the code for me displaying the txt pulled from the mysql database but what do i have to do to make it keep the formatting?

<?php echo $row_rs_pantspanel['review2']; ?>
<?php echo $row_rs_pantspanel['review3']; ?>

Replies

Replied 20 Nov 2002 17:20:15
20 Nov 2002 17:20:15 Tim Green replied:
This question has been asked (and answered) here before...

The answer is to use the nl2br() function of PHP (New Line to <BR> ) .... try the following:-

<?php echo nl2br($row_rs_pantspanel['review2']); ?>
<?php echo nl2br($row_rs_pantspanel['review3']); ?>


Hope this helps

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Edited by - rawveg on 20 Nov 2002 17:20:57

Reply to this topic