Jump to content

[SOLVED] Arcade


eaglelegend

Recommended Posts


Hi I am getting the following in my code:

Parse error: syntax error, unexpected $end in view.php on line 118

 

My code is;

<?php

include "top.php";

if(isset($_GET[cat])) $CurrentCategory = $_GET[cat];
else $CurrentCategory = "";

$res = query("SELECT COUNT(*) FROM games WHERE cat = \"$CurrentCategory\"");
list($total) = mysql_fetch_array($res);

$limit=32;
if(!isset($_GET

))
	$page=1;
else
	$page=$_GET

;

if($total>0)
{
	$p = new pagination();
	$p->Items($total);
	$p->limit($limit);

	if(empty($CurrentCategory)) {
		$p->target('view.php');
	}
	else  {
		$p->target('view.php?cat='.$CurrentCategory);
	}

	$p->currentPage($_GET['page']);
	$p->calculate();
	$p->changeClass("pagination");
}
$counter = 0;
$offset = ($page-1) * $limit;

echo '<div class=navigation>';
if($total>0) $p->show();
echo '</div>';

$res = query("SELECT * FROM games WHERE cat = \"$_GET[cat]\" LIMIT $offset,$limit");

echo '<table width=100% cellpadding=2 cellspacing=0 class=maintable>';
echo '<tr>';

while( $row = mysql_fetch_array($res) ) {

	$imgname = "URL";
	$imgname .= "img/";
	$imgname .= $row[1];
	$imgname .= ".png";
	echo '<td align=center valign=top width=110><CENTER><A HREF=play.php?id='.$row[0].'><img class=imgbox src='.$imgname.' WIDTH=60 HEIGHT=50 BORDER=1 ALT="'.$row[2].'"></A><BR><A HREF=play.php?id='.$row[0].'><B>'. $row[name] .'</B></A><BR><P>'. $row[descr] .'</P></CENTER></td>';

	$counter++;
	if( $counter == 4 ) { echo '</tr><tr>'; $counter = 0; }

if(isset($_GET[rating])) $CurrentRating = $_GET[rating];
else $CurrentRating = "";

$res = query("SELECT COUNT(*) FROM games WHERE rating = \"$CurrentRating\"");
list($total) = mysql_fetch_array($res);

$limit=32;
if(!isset($_GET

))
	$page=1;
else
	$page=$_GET

;

if($total>0)
{
	$p = new pagination();
	$p->Items($total);
	$p->limit($limit);

	if(empty($CurrentRating)) {
		$p->target('view.php');
	}
	else  {
		$p->target('view.php?rating='.$CurrentRating);
	}

	$p->currentPage($_GET['page']);
	$p->calculate();
	$p->changeClass("pagination");
}
$counter = 0;
$offset = ($page-1) * $limit;

echo '<div class=navigation>';
if($total>0) $p->show();
echo '</div>';

$res = query("SELECT * FROM games WHERE rating = \"$_GET[rating]\" LIMIT $offset,$limit");

echo '<table width=100% cellpadding=2 cellspacing=0 class=maintable>';
echo '<tr>';

while( $row = mysql_fetch_array($res) ) {

	$imgname = "URL";
	$imgname .= "img/";
	$imgname .= $row[1];
	$imgname .= ".png";
	echo '<td align=center valign=top width=110><CENTER><A HREF=play.php?id='.$row[0].'><img class=imgbox src='.$imgname.' WIDTH=60 HEIGHT=50 BORDER=1 ALT="'.$row[2].'"></A><BR><A HREF=play.php?id='.$row[0].'><B>'. $row[name] .'</B></A><BR><P>'. $row[descr] .'</P></CENTER></td>';

	$counter++;
	if( $counter == 4 ) { echo '</tr><tr>'; $counter = 0; }
}

echo '</tr>';
echo '</table>';

include "bottom.php";

?>

 

The code is meant to show people the games depending what they clicked on, for example view.php?cat=Action would give them the Action catagory of games, and view.php?rating=Teen for games only suitable for teens, I really dont know why it isnt working, if you could help, that would be great!, and thanks in advance!

 

Mark

Link to comment
https://forums.phpfreaks.com/topic/162226-solved-arcade/
Share on other sites

Your missing a } in your script.

You have two while loops that look the exact same, you did NOT end the first while loop.

   while( $row = mysql_fetch_array($res) ) {

 

That needs to end, that is the first while loop, I'm just not exactly sure where you want that loop to end so I didn't add it for you.

Link to comment
https://forums.phpfreaks.com/topic/162226-solved-arcade/#findComment-856143
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.