2014-03-01 66 views
-1

解析錯誤:語法錯誤,意想不到的「如果」(T_IF)在StatusIG.php在線25PHP - 解析錯誤:語法錯誤,意想不到的T_IF

我真的不看在我的代碼的任何問題,這是爲什麼發生,請幫助。在PHP IM初學者

我的第25行是>>如果($狀態== 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); 

+5

這個問題似乎是脫離主題,因爲它是關於基本的語法錯誤。 – lifetimes

回答

3

你錯過了結束分號:

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

將其替換爲:

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

如果您在此處發佈錯誤,那對我們來說會容易得多。 – Timo

+0

感謝,但現在不同的錯誤 說明:未定義指數:姓名RaiGuardStatusIG.php線路17 警告:mysql_result():無法跳到上的MySQL結果索引4 RaiGuardStatusIG.php線行0 20 警告:mysql_result ():無法跳到第23行的RaiGuardStatusIG.php中的MySQL結果索引5上的行0 第17行:$ name = mysql_real_escape_string($ _GET [「name」],$ con); 第20行:$ player_acc_id = mysql_result($ result_id,0,「account_id」); 第23行:$ status = mysql_result($ result,0,「raiguard」); – user3368877

+0

@ user3368877如何生成您的鏈接以獲取GET名稱? –

相關問題