Not sure about this one, I am trying to execute a SQL query to retrieve records then loop over the records and display X amount per line. Any help is appreciated.

$sql = @mysql_query( "SELECT * FROM subnets", $db );
$num = @mysql_num_rows( $sql );
$subnets .= "<table width=\"100%\"><tr><td bgcolor=\"#C10202\" class=\"fntTR\" colspan=\"$num\">Subnets and global parameters for each</td></tr><tr>";
$i = 1;
while( $list = @mysql_fetch_array( $sql ) ) {
list( $id, $subnet, $mask, $dns01, $dns02, $router, $vlan, $scope, $range1, $range2, $vlan ) = $list;
 if( $i % 2 == 0 ) {
  $tr = "</tr><tr>";
 }
 if( $scope == "no" ) {
  $range1 = "NULL"; $range2 = "NULL";
 }
 $subnets .= "<td valign=\"top\" valign=\"center\">
                          <table cellspacing=\"3\" border=\"0\">
<tr><td colspan=\"2\" align=\"center\"><b><u>$vlan</u></b></td></tr>
                          <tr><td><b>Subnet:</b></td><td>$subnet</td></tr>
                          <tr><td><b>Mask:</b></td><td>$mask</td></tr>
                          <tr><td><b>DNS:</b></td><td>$dns01</td></tr>
                          <tr><td><b>DNS:</b></td><td>$dns02</td></tr>
                          <tr><td><b>Gateway:</b></td><td>$router</td></tr>
                          <tr><td><b>Vlan:</b></td><td>$vlan</td></tr>
<tr><td><b>Scope:</b></td><td>$range1&nbsp;-&nbsp;$range2</td></tr>
                          </table></td>" . $tr;
$i++;
}
$subnets .= "</tr></table>";

--
Jason Gerfen

"When asked what love is:
Love is the Jager talking."
~Craig Baldo

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

Reply via email to