2013-07-09 128 views
0

我試圖展示所有與當前所玩遊戲的類別相關的遊戲。但我得到一個解析錯誤在「if (!empty($_GET['gameId'])) $varGameId = $_GET['gameId'];解析錯誤子查詢

我該如何解決這個問題?

謝謝

<?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); 

?> 
+1

添加分號;後'('') $ varGameId = 0'。 – BlitZ

+0

**注意:**您的代碼受[*** SQL-Injection ***](http://en.wikipedia.org/wiki/SQL_injection)攻擊困擾。找到防止措施[** here **](http://stackoverflow.com/questions/60174/how-to-prevent-sql-injection-in-php)。 – BlitZ

回答

0

的錯誤是在這裏,分號丟失:

$varGameId = 0 
0

你錯過這裏分號:$varGameId = 0