Re: help with nl2br

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

 



canobit canobit 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.
<snip /><snip />
 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";  <snip />

There is no nl2br in your code sample, so I'm assuming you want to put $row[2] through it? It's about as simple as nl2br($row[2]). If that doesn't work, then perhaps you should post sample code that is failing, and the output you get, along with the output you're expecting.

All that said, you might want to invest some time in learning a DB abstraction layer such as ADODb or PEAR::DB (there are lots of others). You'll commonly find convenience functions to do things like output query results into an HTML table. Why waste time debugging the wheel?

--
Max Schwanekamp
http://www.neptunewebworks.com/

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


[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