help with nl2br

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

 



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);


?>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux