Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Tangled if-else

  1. #1
    New Coder
    Join Date
    Jun 2012
    Posts
    57
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Internet Explorer Tangled if-else

    Now I am writing code that uses if-else statements and even though I've checked syntax correctly, it says:Parse error: syntax error, unexpected T_ELSE in /home/a7347456/public_html/structure/achievements.php on line 77

    (77 is almost the last line, BTW)

    So, I've seen this before and I make sure that all if's and else's are closed and all that, and it still doesn't work!

    So here is the code in question:



    PHP Code:
    $achieve4 $_POST['HomeCoinLocator'];

    $achieve5 $_POST['5'];

    if (
    $achieve4 == 'Yes')

    {

    $astrSQL "SELECT * FROM Awards_Inv WHERE Username = '$username'"

    $rs3 mysql_query($astrSQL$connection); 

    while(
    $row3 mysql_fetch_array($rs3)){ 

    $soar4 $row3["Home Coin Locator"]; 

    if (
    $soar4 == "Yes"



    $soa4 "Yes"

    $endtext "You have completed this achievement already."



    else 



    $soa4 "No"

    $endtext "Rewards:<br>+120 Coins<br>+10 Skill Points<br>+1 Award"

    $awardSTRsql "UPDATE Awards_Inv SET `Home Coin Locator` = 'Yes' WHERE Username = '$username'";

    mysql_query($awardSTRsql$connection); 

    $updatestats1STRsql "UPDATE User_Info SET Coins = Coins + 120 WHERE Username = '$username'"

    $updatestats2STRsql "UPDATE User_Info SET `Skill Points` = `Skill Points` + 10 WHERE Username = '$username'"

    $updatestats3STRsql "UPDATE User_Info SET Awards = Awards + 1 WHERE Username = '$username'"

    mysql_query($updatestats1STRsql$connection); 

    mysql_query($updatestats2STRsql$connection); 

    mysql_query($updatestats3STRsql$connection); 

    }

    }

    [
    B]else

    {

    }[/
    B


    The bolded area is the part that I tried to remove, but then it says that it needs something to end at the last line...

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,519
    Thanks
    8
    Thanked 1,090 Times in 1,081 Posts
    I see no closing bracket for this "if" statement ...


    if ($achieve4 == 'Yes')

    {


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •