Page 1 of 1

Need this to show more than 1 result from a table

Posted: Sun Nov 11, 2007 2:13 pm
by Monotoko
Hi guys below you will find an extract from a game script i have made

Code: Select all

if ($hello=="")
{
echo "IP doesnt exist";
}
else
{
echo "You were able to ping something, the open ports on this server are displayed below";

$result = mysql_query("SELECT * FROM ports
WHERE ip='$ip'");

while($row = mysql_fetch_array($result))
  {
$ports = $row['port'];
  }
echo $ports;
}
Now, there are multiple entries in the table for each ip, yet it is only showing me one, i would like it to show them all, how would i go about this?

Thank You
~Monotoko

Posted: Sun Nov 11, 2007 2:23 pm
by feyd
Echoing during the loop, not after, is a simply way.

Posted: Sun Nov 11, 2007 2:53 pm
by Monotoko
thanks, that did it