PHP - 解析错误:语法错误,意外T_IF

时间:2014-03-01 17:58:03

标签: php mysql if-statement syntax

解析错误:语法错误,第25行上StatusIG.php中的意外'if'(T_IF)

我真的没有看到我的代码中有任何问题,为什么会发生这种情况,请帮忙。我是PHP的初学者

我的LINE 25是>> if($ status == 0)


    $accountdb_ip = "ip"; //Accountserver-IP
    $accountdb_login = "acc"; //Accountserver-Loginname
    $accountdb_pw = "psw"; //Accountserver-Passwort
    $db_ip = "ip"; //DB-Server-IP
    $db_login = "acc"; //DB-Server-Loginname
    $db_pw = "psw"; //DB-Server-Passwort

    $con = mysql_connect($db_ip, $db_login, $db_pw);
    $con_account = mysql_connect($accountdb_ip, $accountdb_login, $accountdb_pw);
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }

    $name = mysql_real_escape_string($_GET["name"], $con);

    $result_id = mysql_query("SELECT * FROM player.player WHERE name='".$name."' LIMIT 1", $con);
    $player_acc_id = mysql_result($result_id, 0, "account_id");

    $result = mysql_query("SELECT * FROM account.account WHERE id='".$player_acc_id."'", $con);
    $status = mysql_result($result, 0, "raiguard")

    if($status == 0)
        {echo "0";}
    elseif($status == 1)
        {echo "1";}
    elseif($status == 2)
        {echo "2";}

    mysql_close($con);
    mysql_close($con_account);

1 个答案:

答案 0 :(得分:3)

你错过了分号:

$status = mysql_result($result, 0, "raiguard")

将其替换为:

$status = mysql_result($result, 0, "raiguard");