It is not easy to design a SQL query that will repeat headers every 33 rows. So this should be done in the PHP code. Why not use a counter, that you increment at every mysql_fetch_array() and test if !( $counter % 33 ) Side remarks: you could also define a CSS class for TH and use TH as headers. Thus you avoid having those unpleasant "bgcolor='#ffffff'". Or use a different TD class for that matter. Also I suppose that the count( $results ) is intended to be used to define the width attribute, but it does not seem to appear in your HTML. HTH Ignatius ____________________________________________ ----- Original Message ----- From: "Sam Folk-Williams" <sfolkwilliams@mn.rr.com> To: <php-db@lists.php.net> Sent: Saturday, February 15, 2003 6:26 PM Subject: printing repeat table headers > 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 </td> > <td class='print' bgcolor='#ffffff'>$office_phone </td> > <td class='print' bgcolor='#ffffff'>$ext </td> > <td class='print' bgcolor='#ffffff'>$staff_email </td> > <td class='print' bgcolor='#ffffff'>$staff_phone </td> > <td class='print' bgcolor='#ffffff'>$staff_phone2 </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 > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php