0

I'm trying to show all the games related to the category of the current game played. But I'm getting a parse error in "if (!empty($_GET['gameId'])) $varGameId = $_GET['gameId'];"

How can I solve this?

Thank you

<?php
$varCategoria_GameData = "0";
$varGameId = 0
if (!empty($_GET['gameId'])) $varGameId  = $_GET['gameId'];
if (isset($_GET["cat"])) {
 $varCategoria_GameData = $_GET["cat"];
}

$sql_categoria = "SELECT * FROM jogos WHERE intCategoria =
( SELECT intCategoria FROM jogos WHERE idGames = $varGameId )";
$query_categoria = mysql_query($sql_categoria, $gameconnection) or die(mysql_error()); 
$categoria = mysql_fetch_assoc($query_categoria);

?> 
BlitZ
  • 12,038
  • 3
  • 49
  • 68
  • 1
    Add semicolon (`;`) after `$varGameId = 0`. – BlitZ Jul 09 '13 at 02:28
  • **NOTE:** Your code is vulnurable to [***SQL-Injection***](http://en.wikipedia.org/wiki/SQL_injection) attacks. Find prevent measures [**here**](http://stackoverflow.com/questions/60174/how-to-prevent-sql-injection-in-php). – BlitZ Jul 09 '13 at 02:33

2 Answers2

0

The error is here, semi-colon missing:

$varGameId = 0
Marcovecchio
  • 1,322
  • 9
  • 19
0

You miss semi colon here: $varGameId = 0

JunM
  • 7,040
  • 7
  • 37
  • 58