Page 1 of 1

Need help on nl2br

Posted: Sun Dec 19, 2010 7:10 am
by Wong
Hi guys

I am a newbie to php and do need some help from you all,

Code: Select all

<?php
$con = mysql_connect("localhost","root","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("countries", $con);

$result = mysql_query("SELECT * FROM table_int");


echo "<table border='1'>
<tr>
<th>IP Address</th>
<th>Descriptions</th>
<th
</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['IP'] . "</td>";
  echo "<td>" . $row['Descriptions'] . "</td>";
  echo "</tr>";
  }
echo "</table>";
mysql_close($con);
?>
The result was fine till on the description side it was printed as below

No port for an ssh connect was found open.\nHence local security checks might not work.\n

I am trying to use nl2br but not sure how it work, appreciate if someone can guide me on this.

Re: Need help on nl2br

Posted: Sun Dec 19, 2010 12:04 pm
by Jonah Bron
Where do you want to put it? And please edit your post to surround your code with tags (the PHP Code button), and indent your code.

Re: Need help on nl2br

Posted: Mon Dec 20, 2010 10:20 am
by pickle
Moved to correct forum.