php 解析错误:语法错误,意外的 T_ECHO 在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15689501/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 09:45:25  来源:igfitidea点击:

Parse error: syntax error, unexpected T_ECHO in

php

提问by Arm103

What is causing this error?

是什么导致了这个错误?

Parse error: syntax error, unexpected T_ECHO in C:\wamp\www\game\rankings.php on line 19

解析错误:语法错误,C:\wamp\www\game\rankings.php 中的意外 T_ECHO 第 19 行

Here is the code

这是代码

<?php
session_start();
include("header.php");
if(!isset($_SESSION['uid'])) {
  echo "You must be logged in to view this page";
}else{ 
  ?>
  <center><h2>Battle Players</h2></center>
  <br />
  <table cellpadding="2" cellspacing="2">
    <tr>
      <td width="50px"><b>Rank</b></td>
      <td width="150px"><b>Username</b></td>
      <td width="200px"><b>Gold</b></td>
    </tr>
    <?php
    $get_users = mysql_query("SELECT `id`,`overall` FROM `ranking` WHERE `overall`>'0' ORDER BY `overall` ASC") or die(mysql_error());
    while($row = mysql_fetch_assoc($get_users)) { var_dump($row)
    echo "<tr>";
    echo "<td>". $row['overall']. "</td>";
    $get_user = mysql_query("SELECT `username` FROM `user` WHERE `id`='".$row['id']."'") or die(mysql_error());
    $rank_name = mysql_fetch_assoc($get_user);
    echo "<td><a href=\"stats.php?id=" .$row['id']."\">" . $rank_name['username'] . "</a></td>";
    $get_gold = mysql_query("SELECT `gold` FROM `stats` WHERE `id`='".$row['id']."'") or die(mysql_error());
    $rank_gold = mysql_fetch_assoc($get_gold);
    echo "<td>" . number_format($rank_gold['gold']) . "</td>";
    echo "</tr>";
    }
    ?>
  </table>
  <?php
}
include("footer.php");
?>

also at http://pastebin.com/3nw310en

也在 http://pastebin.com/3nw310en

回答by Ricardo Alvaro Lohmann

Missing ;after var_dump($row)

失踪;var_dump($row)