<?
// list.php - display list of five most recent press releases
?>
<html>
<head>
<basefont face="Verdana">
</head>
<body>
<!-- standard page header begins -->
<p> <p>
<table width="100%" cellspacing="0" cellpadding="5">
<tr>
<td></td>
</tr>
<tr>
<td bgcolor="Navy"><font size="-1" color="White"><b>Pistons Central</b></font></td>
</tr>
</table>
<!-- standard page header ends -->
<ul>
<?
// includes
include("../conf.php");
include("../functions.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 id, slug, timestamp FROM news ORDER BY timestamp DESC LIMIT 0, 5";
$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))
{
?>
<li><font size="-1"><b><a href="story.php?id=<? echo $row->id; ?>"><? echo $row->slug; ?></a></b></font>
<br>
<font size="-2"><? echo formatDate($row->timestamp); ?></font>
<p>
<?
}
}
// if no records present
// display message
else
{
?>
<font size="-1">No news items currently available</font>
<?
}
// close database connection
mysql_close($connection);
?>
</ul>
<!-- standard page footer begins -->
<p>
<table width="100%" cellspacing="0" cellpadding="5">
<tr>
<td align="center"><font size="-2">Pistons Central</td>
</tr>
</table>
<!-- standard page footer ends -->
</body>
</html>