I have the following code. What I am trying to do, is every 10 lines outputted to include a table row/header that is standard.
<?
// includes
include("configz.php");
// open database connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
// generate and execute query
$query = "SELECT * FROM ranking ORDER BY ID ASC";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
// if records present
if (mysql_num_rows($result) > 0)
{
// iterate through resultset
// print article titles
while($row = mysql_fetch_object($result))
{
?>
<tr>
<td width="15" valign="top" align="right"><? echo $row->rank; ?></td>
<td width="15" valign="top" align="center"><? echo $row->change; ?></td>
<td width="200" valign="top" align="left"><a href="team.php?team=<? echo $row->team; ?>"><? echo $row->team; ?></a></td>
<td width="175" valign="top" align="left"><? echo $row->conference; ?></td>
<td width="15" valign="top" align="center"><? echo $row->won; ?></td>
<td width="15" valign="top" align="center"><? echo $row->lost; ?></td>
<td width="50" valign="top" align="center"><? echo $row->ranking; ?></td>
<td width="50" valign="top" align="center"><? echo $row->sos; ?></td>
<td width="50" valign="top" align="center"><? echo $row->sosrk; ?></td>
</tr>
<?
}
}
// if no records present
// display message
else
{
?>
<font class="text-content">This item cannot be found in our database.</font>
<?
}
// close database connection
mysql_close($connection);
?>
Is my code. After rows 1-10 (11-20, etc, etc), I want it to output:
<tr>
<td width="15" valign="top" align="right"><strong>RANK</strong></td>
<td width="15" valign="top" align="center"><strong>CHNG</strong></td>
<td width="200" valign="top" align="left"><strong>SCHOOL</strong></td>
<td width="175" valign="top" align="left"><strong>CONF</strong></td>
<td width="15" valign="top" align="center"><strong>W</strong></td>
<td width="15" valign="top" align="center"><strong>L</strong></td>
<td width="50" valign="top" align="center"><strong>INDEX</strong></td>
<td width="50" valign="top" align="center"><strong>SOS</strong></td>
<td width="50" valign="top" align="center"><strong>SOSRK</strong></td>
</tr>
Any help would be greatly appreciated.