0

我正在开发一个在线游戏网站,我想要实现的是,当我在玩游戏时,我想在同一页面中显示与当前所玩游戏类别相关的所有游戏。例如:我正在玩 id = 4 并且该游戏的类别为 = 3 的游戏。我想显示与类别 3 相关的所有游戏。等等。谢谢

CREATE TABLE IF NOT EXISTS `jogos` (
`idGames` int(11) NOT NULL AUTO_INCREMENT,
`strNome` varchar(100) DEFAULT NULL,
`intCategoria` int(11) DEFAULT NULL,

 $varCategoria_GameData = "0";
 if (isset($_GET["cat"])) {
 $varCategoria_GameData = $_GET["cat"];
 }
 mysql_select_db($database_gameconnection, $gameconnection);
 $query_GameData = sprintf("SELECT * FROM jogos WHERE jogos.intCategoria = %s",     GetSQLValueString($varCategoria_GameData, "int"));
 $GameData = mysql_query($query_GameData, $gameconnection) or die(mysql_error());
 $row_GameData = mysql_fetch_assoc($GameData);
  $totalRows_GameData = mysql_num_rows($GameData);
   if (!isset($_SESSION)) {
 session_start();
 }?>
4

1 回答 1

0

How about this ?

SELECT * FROM jogos WHERE intCategoria =
( SELECT intCategoria FROM jogos WHERE idGames = $currentGameId )

Where $currentGameId is the id of the game being played.

于 2013-07-08T02:52:12.660 回答