printing repeat table headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm printing the results of a DB query that gets a 300 row staff directory.
All 300 rows appear on one page. The top of the HTML table has basic headers
like "First Name, Last Name, Email" etc, then all 300 rows print underneath
the headers. What I would like to do is have those headers repeat every 33
rows, so that as the user scrolls down that can still see the table headers
every so often. I feel like this should be easy, but it's giving me a hard
time. Any suggestions? My code is below.

Thanks, Sam


$tableHeaders = "

  <tr>
    <td  class='printRev'><b>Staff Name</b></td>
    <td class='printRev'><b>Office Location</b></td>
    <td class='printRev'><b>Primary Telephone</b></td>
    <td class='printRev'><b>Ext</b></td>
    <td class='printRev'><b>Email</b></td>
    <td class='printRev'><b>Direct Telephone</b></td>
    <td class='printRev'><b>Cell/Pager</b></td>
  </tr>
";

echo "<table width='850' border='1' cellpadding='1' cellspacing='0'
bordercolor='#000000'>";
echo "$tableHeaders";

while ($row = mysql_fetch_array($result)) {

  $count = count($result);
  $staff_id = $row['staff_id'];
        $staff_fname = $row['staff_fname'];
        $office_name = $row['office_name'];
        $staff_lname = $row['staff_lname'];
        $staff_phone = $row['staff_phone'];
        $staff_phone2 = $row['staff_phone2'];
        $staff_email = $row['staff_email'];
        $office_phone = $row['office_phone'];
  $ext = $row['ext'];
//strip slashes from textfields

$staff_fname = stripslashes($staff_fname);
$staff_lname = stripslashes($staff_lname);
$office_name = stripslashes($office_name);
$tableContent = "

  <tr>
    <td class='print' bgcolor='#ffffff'>$staff_lname, $staff_fname</td>
    <td class='print' bgcolor='#ffffff'>$office_name&nbsp;</td>
    <td class='print' bgcolor='#ffffff'>$office_phone&nbsp;</td>
    <td class='print' bgcolor='#ffffff'>$ext&nbsp;</td>
    <td class='print' bgcolor='#ffffff'>$staff_email&nbsp;</td>
    <td class='print' bgcolor='#ffffff'>$staff_phone&nbsp;</td>
    <td class='print' bgcolor='#ffffff'>$staff_phone2&nbsp;</td>
  </tr>";


 echo "$tableContent";
  } //close while loop

echo "
</table>
";



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux