PHP MySQL 可能存在语法错误

标签 php mysql syntax

我不知道为什么,但我在这一行遇到错误:$row = mysql_fetch_array($run_games)){ 这是代码:

<div class='topnav'> <!--Start of the Top Navigation-->
<?php
include("includes/connect.php");

$select_games = "SELECT * FROM games";

$run_games = mysql_query($select_games);

$row = mysql_fetch_array($run_games)){

$game_category = $row['game_category'];

?>

<!--some links here with the variable of "game_category"-->
<?php } ?>
</div> <!--End of the Top Navigation-->

请帮助我:(

最佳答案

应该是..

while($row = mysql_fetch_array($run_games))
{
echo $game_category = $row['game_category'];
}

您需要循环遍历结果集!

关于PHP MySQL 可能存在语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21761499/

相关文章:

php - 插入后如何修复mysql列值

php - 使用 cURL 从 URL 保存 Facebook 个人资料图片无法正常工作 2018 年 3 月 27 日之后

PHP 将大写单词转换为小写单词,但保留小写单词上的 ucfirst

mysql - 创建新表时插入另一个表中的值

c++ - 为什么这会调用默认构造函数?

php - 使用未定义常量 App - 在 Laravel 中假设为 'App'

mysql - 在 MySQL 中,是否可以从 GROUP_CONCAT 返回超过 1024 个字符

mysql - 选择前 n 金额(考虑某些记录具有相同金额)

mysql - 打印 mysql 查询

ruby - 如何理解用于 bool 比较的 '...' 运算符