Forums

PHP

This topic is locked

Formating text PhP/Mysql

Posted 18 Mar 2003 18:38:08
1
has voted
18 Mar 2003 18:38:08 Buster Smith posted:
Newbie questions.
When i enter in an article lets say in my database and then output it on my site, there is no formating, just one big paragraph. Can someone tell me the best way to format the text? Im using DW MX, PHP, Mysql. Thanks again

Replies

Replied 18 Mar 2003 22:00:16
18 Mar 2003 22:00:16 Iain Stewart replied:
use

nl2br( echo $rsInfo->Fields('info') );

in your dymanic text
converts new line 2 <br>

Iain

head hurts, 'mental note to self, stop banging head !'
Replied 19 Mar 2003 02:05:14
19 Mar 2003 02:05:14 Buster Smith replied:
Thanks iainkd for your response, when u say in your dynamic text you mean i have to place the code somewhere, im just using dreamweaver to write code and dont really know much about php but will learn in time,

head hurts php is bad for your health
Replied 19 Mar 2003 11:59:57
19 Mar 2003 11:59:57 Iain Stewart replied:
Hi,

use dreamweaver to allow you to view code and page layout, this will allow you to see what code is being written, helps with the learning process.

When you pull across the databinding onto the page to pull the info out of the database, in code view you will see the added code

echo $rsInfo->Fields('info');

edit this to read

nl2br ( echo $rsInfo->Fields('info') );

this will keep the required format of your text in the database.

hope this helps better.

Iain

head hurts, 'mental note to self, stop banging head !'

Reply to this topic