I'm trying to present a phone directory in a printable format that will make "most" people happy. What I need to do is take the results from our database and "break" it into two tables. ie.

<table>
Extension FName LName Dept.
...25x
</table>
<table>
Extension FName LName Dept.
...Records 26+
</table>

This is what I have done without success:

$result = mssql_query($sql);

echo "<table border=1>\n";
echo "<tr>\n";
echo "<td>Extension\n";
echo "</td>\n";
echo "<td>First Name\n";
echo "</td>\n";
echo "<td>Last Name\n";
echo "</td>\n";
echo "<td>Dept.\n";
echo "</td>\n";
echo "</tr>\n";
while($row = mssql_fetch_array($result)) {
$n++;
echo "<tr>\n";
echo "<td>$row[0]\n";
echo "</td>\n";
echo "<td>$row[1]\n";
echo "</td>\n";
echo "<td>$row[2]\n";
echo "</td>\n";
echo "<td>$row[3]\n";
echo "</td>\n";
echo "</tr>\n";
If ($n==40) {
echo "</table>\n";
echo "<br>";
echo "<table border=1>\n";
echo "<tr>\n";
echo "<td>$row[0]\n";
echo "</td>\n";
echo "<td>$row[1]\n";
echo "</td>\n";
echo "<td>$row[2]\n";
echo "</td>\n";
echo "<td>$row[3]\n";
echo "</td>\n";
echo "</tr>\n";
} else {
}
}
echo "</table>\n";

It successfully closes that table after 40 records, but the remaining records are at the bottom of the page. What I'd like to end up with is 2 columns with 40 records in each column
Ext. FName LName Dept. | Ext. FName LName Dept.
1 41
... ...
40

Any help is appreciated.


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

Reply via email to