Forum Moderators: coopster
Print "<table width='935' cellpadding='1' cellspacing='0' border='0' align='center'>";
$count = 0;
$columns = 5; //column number declaration
if(mysql_num_rows($result)){
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
// display list if there are records to display
if($count == 0)
Print "<tr>";
echo '<td bgcolor="#000000">';
echo '<b><a href="http://'.$row['website'].'" target="_blank">New Site</a></b>';
if($count == $columns - 1)
Print "</tr>";//here without the!
$count = ++$count % $columns;
}
if($count!= 0)
Print "</tr>";
Print "</table>";
echo "<table width='935' cellpadding='1' cellspacing='0' border='0' align='center'>";
$count = 0;
$columns = 5; //column number declaration
$light = 'style="background:#fff"';
$tint = 'style="background:#fbfbfb';
//
if(mysql_num_rows($result)){
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
// display list if there are records to display
//
$bg = ($bg==$tint)?$light:$tint;
if($count == 0) { Print "<tr>"; }
echo "<td $bg>";
//
echo '<b><a href="http://'.$row['website'].'" target="_blank">New Site</a></b>';
//
$count++;
if ($count >= $columns) { echo "</tr>"; $count= 0; }
}
}
// Last row fix
if (($count > 0) and ($count < $columns)) {
for ($i=$count;$i<$columns;$i++) {
echo "<td $bg> </td>";
echo "</tr>";
}
}
echo "</table>";
if($rows = mysql_num_rows($result)) {
echo '<table>' .
"\n\t" . '<tr>' .
"\n\t\t" . '<td>Col 1</td>' .
"\n\t\t" . '<td>Col 2</td>' .
"\n\t\t" . '<td>Col 3</td>' .
"\n\t\t" . '<td>Col 4</td>' .
"\n\t\t" . '<td>Col 5</td>';
for($i = 0; $i < $rows; $i++) {
if($n = ($i % 5)) {
echo "\n\t\t" . '<td><b>' . ($i + 1) . '. <a target="_blank" href="http://' . mysql_result($result, $i, "website") . '">New site</a></b></td>'
} else {
echo "\n\t" . '</tr>' .
"\n\t" . '<tr>' .
"\n\t\t" . '<td><b>' . ($i + 1) . '. <a target="_blank" href="http://' . mysql_result($result, $i, "website") . '">New site</a></b></td>';
}
}
if($n) {
for($i = $n; $i < 5; $i++) {
echo "\n\t\t" . '<td> </td>';
}
}
echo "\n\t" . '</tr>' . "\n" . '</table>';
}
error_reporting(E_ALL);
ini_set('display_errors', '1'); error_reporting(E_ALL);
ini_set('display_errors', '1');
php_flag display_errors on