Thanks Pablo, that did the trick with one minor change, I had to remove the . in the quotations as it is was leading the first line of text with a . echo "" . nl2br($row[2]) . "</b>"; TD. On 3/3/06, Pablo M. Rivas <pmrivas@xxxxxxxxx> wrote: > > Hello canobit: > > Did you try echo "." . nl2br($row[1]) . "</b>"; ?? > > > On 3/2/06, canobit canobit < canobit@xxxxxxxxx> wrote: > > > > I have cobbled the following code that when it retrieves the data from > > Mysql, the data is displayed with no line breaks which results in one > > large > > paragraph. I have been trying for quite awhile ....without sucess to get > > nl2br working with this code. The original data is entered by the user > > via a > > textarea form. > > > > Any help would be much apreciated...I am still fairly new at programming > > and > > it probably shows... > > > > Thanks > > TD. > > > > > > <?php > > > > // set database server access variables: > > $host = "localhost"; > > $user = "develop"; > > $pass = "********"; > > $db = "bio"; > > > > // open connection > > $connection = mysql_connect($host, $user, $pass) or die ("Unable to > > connect!"); > > > > // select database > > mysql_select_db($db) or die ("Unable to select database!"); > > > > // create query > > $query = "SELECT * FROM main"; > > > > // execute query > > $result = mysql_query($query) or die ("Error in query: $query. > > ".mysql_error()); > > > > // see if any rows were returned > > if (mysql_num_rows($result) > 0) { > > // yes > > // print them one after another > > echo "<table cellpadding=0 width = 100% border=0>"; > > > > while($row = mysql_fetch_row($result)) { > > > > echo "<tr><font color=blue size =4>"; > > echo ".$row[1]</b>"; > > echo "<tr><font color=black size = 3>"; > > echo ".$row[2]"; > > echo " <br> \n"; > > echo " <br> \n"; > > > > } > > > > } > > else { > > // no > > // print status message > > echo "No rows found!"; > > } > > > > // free result set memory > > mysql_free_result($result); > > > > // close connection > > mysql_close($connection); > > > > > > ?> > > > > > > > -- > Pablo M. Rivas. http://www.r3soft.com.ar http://www.tres-erres.com.ar > ----------------------------------------------------------- >