eaglelegend Posted June 15, 2009 Share Posted June 15, 2009 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 Quote Link to comment Share on other sites More sharing options...
Skepsis Posted June 15, 2009 Share Posted June 15, 2009 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. Quote Link to comment Share on other sites More sharing options...
eaglelegend Posted June 15, 2009 Author Share Posted June 15, 2009 Thank you so much skepsis!, I figured out where the } was meant to be! and it works perfectly now! Quote Link to comment Share on other sites More sharing options...
Skepsis Posted June 15, 2009 Share Posted June 15, 2009 No problem! Please click the topic solved button so people wont try to help without knowing that this issue has already been resolved, thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.