What would I do, if I wanted to just pull the the first 20 records or the last 20 records from the table?
This is what I have now:
Code: Select all
<?php
$sql="SELECT * FROM records ORDER BY matchDate ASC";
$result=mysql_query($sql,$DB);
?>
<table width="480" border="0" align="center" class="hostileText">
<tr bgcolor="#000000">
<td width="20%"><div align="center"><u><font color="#FFFFFF" >Date</font></u></div></td>
<td width="20%"><div align="center"><u><font color="#FFFFFF" >Map</font></u></div></td>
<td width="20%"><div align="center"><u><font color="#FFFFFF" >Opponent</font></u></div></td>
<td width="20%"><div align="center"><u><font color="#FFFFFF" >Score</font></u></div></td>
<td width="20%"><div align="center"><u><font color="#FFFFFF" >Stats</font></u></div></td>
</tr>
<?php
$i=0;
while($row=mysql_fetch_assoc($result)){
$bgcolor=($i%2==0)?'#333333':'#666633';
$i++;
?>
<tr>
<td bgcolor="<?php echo $bgcolor; ?>"><div align="center"><font color="#FFFFFF"><?php echo $row['matchDate']; ?></font></div></td>
<td bgcolor="<?php echo $bgcolor; ?>"><div align="center"><font color="#FFFFFF"><?php echo $row['matchMap']; ?></font></div></td>
<td bgcolor="<?php echo $bgcolor; ?>"><div align="center"><font color="#FFFFFF"><?php echo $row['matchOpp']; ?></font></div></td>
<td bgcolor="<?php echo $bgcolor; ?>"><div align="center"><font color="#FFFFFF"><?php echo $row['matchScore']; ?></font></div></td>
<td bgcolor="<?php echo $bgcolor; ?>"><a href="../<?php echo $row['matchStats']; ?>" target="_blank">
<div align="center">view stats</div></td>
</tr>
<?php }
?>
</table>