我正在尝试显示与其类别相关的所有游戏,我在这里尝试的 Sql 仅显示与游戏 5 相关的游戏,如何自动显示所有游戏?
<?php
$varCategoria_GameData = "0";
if (isset($_GET["cat"])) {
$varCategoria_GameData = $_GET["cat"];
}
$sql_categoria = "SELECT * FROM jogos WHERE intCategoria =
( SELECT intCategoria FROM jogos WHERE idGames = 5)";
$query_categoria = mysql_query($sql_categoria, $gameconnection) or die(mysql_error());
$categoria = mysql_fetch_assoc($query_categoria);
?>
<?php do { ?>
<?php echo '<h1>'.$categoria['idGames'].'</h1>'; ?>
<?php } while ($categoria = mysql_fetch_assoc($query_categoria)); ?>