Release Dates - Sorted By: Date";
echo "
";
$offset = ($pageNum - 1) * $rowsPerPage;
if ($var == "cs" && $platId == "") {
$query = "SELECT games.title, platform.sysabbr, date_format(games.date, '%d %b %Y'), links.link, games.scrn, games.genre, games.theme FROM games, platform, links WHERE games.platform=platform.platID and links.gameId=games.gameId and games.date > CURDATE() ORDER BY games.date asc, games.title asc, platform.sysabbr asc LIMIT $offset, $rowsPerPage";
$queryct = "SELECT COUNT(gameId) AS numrows FROM games WHERE date > CURDATE()";
$t = "var=cs";
}
else if ($platId != "" && $var == "") {
$query = "SELECT games.title, platform.sysabbr, date_format(games.date, '%d %b %Y'), links.link, games.scrn, games.genre, games.theme,platId FROM games, platform, links WHERE games.platform=platform.platId and platform.platId=$platId and links.gameId=games.gameId and games.date <= CURDATE() ORDER BY games.date desc, games.title asc, platform.sysabbr asc LIMIT $offset, $rowsPerPage";
$queryct = "SELECT COUNT(gameId) AS numrows FROM games WHERE date <= CURDATE() AND platform='$platId'";
$pv = "plat=$platId";
}
else if ($platId != "" && $var=="cs") {
$query = "SELECT games.title, platform.sysabbr, date_format(games.date, '%d %b %Y'), links.link, games.scrn, games.genre, games.theme FROM games, platform, links WHERE games.platform=platform.platID and platform.platId=$platId and links.gameId=games.gameId and games.date > CURDATE() ORDER BY games.date asc, games.title asc, platform.sysabbr asc LIMIT $offset, $rowsPerPage";
$queryct = "SELECT COUNT(gameId) AS numrows FROM games WHERE date > CURDATE() AND platform='$platId'";
$t = "var=cs";
$pv = "plat=$platId";
}
else {
$query = "SELECT games.title, platform.sysabbr, date_format(games.date, '%d %b %Y'), links.link, games.scrn, games.genre, games.theme FROM games, platform, links WHERE games.platform=platform.platID and links.gameId=games.gameId and games.date <= CURDATE() ORDER BY games.date desc, games.title asc, platform.sysabbr asc LIMIT $offset, $rowsPerPage";
$queryct = "SELECT COUNT(gameId) AS numrows FROM games WHERE date <= CURDATE()";
}
// how many rows we have in database
$resultct = mysql_query($queryct) or die('Error, query failed');
$rowct = mysql_fetch_array($resultct, MYSQL_NUM);
$numrows = $rowct[0];
// how many pages we have when using paging?
$maxPage = ceil($numrows/$rowsPerPage);
$result=@mysql_query($query);
$j=0;
while($row=@mysql_fetch_array($result,MYSQL_NUM)) {
if ($j == 5 || $j == 10) {
echo "";
}
if ($j < $numrows-1) {
echo "
- ";
echo '
";
$j++;
}
else {
echo "";
}
$title_prev = $row[0];
}
echo "
»";
$self = $_SERVER['PHP_SELF'];
$nav = '';
for($page = 1; $page <= $maxPage; $page++) {
if ($page == $pageNum) {
$nav .= " $page "; // no need to create a link to current page
}
else {
$nav .= " $page ";
}
}
if ($pageNum > 1) {
$page = $pageNum - 1;
$prev = " [Prev] ";
$first = " [First Page] ";
}
if ($pageNum < $maxPage) {
$page = $pageNum + 1;
$next = " [Next] ";
$last = " [Last Page] ";
}
// print the navigation link
echo $first . $prev . $nav . $next . $last;
?>
«
