Need help on nl2br

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Wong
Forum Newbie
Posts: 1
Joined: Sun Dec 19, 2010 7:03 am

Need help on nl2br

Post 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.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Need help on nl2br

Post 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.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Need help on nl2br

Post by pickle »

Moved to correct forum.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply