Results 1 to 3 of 3

Thread: Why wont this code work?

  1. #1
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    133
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default Why wont this code work?

    Here is my code:
    PHP Code:
    <?php
    if(isset($New))
    {
    if(
    $New=="Join Castles Bank"){
    if(
    $User[Gold]>'9999999'){
    mysql_query("Update Users set Gold=Gold-'10000000' where ID='$Player'") or die("Could not find player stats");
    mysql_query("Update Users set BankChoice='Cas' where ID='$Player'") or die("Could not find player stats");
    echo 
    "Congratulations, you just joined the Castles Bank! As a reminder, all of your deposits cost 5% which goes to the bank. <a href=bank.php>Start Banking</a>";
    exit;
    }else{
    echo 
    "You can not join this bank at the moment. Please make more money first. <a href=bank.php>Go back</a>";
    exit;
    }
    }elseif(
    $New=="Join Hells Bank"){
    if(
    $User[Gold]>'99999999'){
    mysql_query("Update Users set Gold=Gold-'100000000' where ID='$Player'") or die("Could not find player stats");
    mysql_query("Update Users set BankChoice='Hell' where ID='$Player'") or die("Could not find player stats");
    echo 
    "Congratulations, you just joined the Hells Bank! As a reminder, all of your deposits cost 10% which goes to the bank. <a href=bank.php>Start Banking</a>";
    exit;
    }else{
    echo 
    "You can not join this bank at the moment. Please make more money first. <a href=bank.php>Go back</a>";
    exit;
    }
    }elseif(
    $New=="Join Apocalyptic Bank"){
    if(
    $User[Gold]>'999999999'){
    mysql_query("Update Users set Gold=Gold-'1000000000' where ID='$Player'") or die "Could not find player stats");
    mysql_query("Update Users set BankChoice='Apoc' where ID='$Player'") or die("Could not find player stats");
    echo 
    "Congratulations, you just joined the Apocalyptic Bank! As a reminder, all of your deposits cost 25% which goes to the bank. <a href=bank.php>Start Banking</a>";
    exit;
    }else{
    echo 
    "You can not join this bank at the moment. Please make more money first. <a href=bank.php>Go back</a>";
    exit;
    }
    }
    }
    ?>
    I know I code it weird because sometimes im too lazy to write the quotes, however it normaly works the way that I do it. Im afraid ive gone over it again and again and cannot figure out the problem. I tried error reporting and it just gives me a blank screen...

    PS, FOUND IT, MISSING A ( IN ONE OF THE MYSQL QUERIES, CASE CLOSED
    Last edited by Demonicman; 11-09-2008 at 08:59 AM.
    http://www.insanecombat.com << bored? check out ma game

  2. #2
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    What happens when you try to run this? Blank Screen?

    If that is the case, maybe one of your exit(); is being executed prior to any output.

    you are missing some () and {} and with out any tabs, the code you posted is very difficult to read.

    Try coding like this:

    Code:
    if ( x > y ) {
    
         echo "$var";
    
    } else {
    
         echo "something else";
    
         if ( x > y ) {
    
              echo "somthing";
    
         }
    
    }
    It is so much easier to find mistakes this way.

    Good luck. I'll keep looking at it, but if you could clean it up it would help us and you.

    J

  3. The Following User Says Thank You to JasonDFR For This Useful Post:

    Demonicman (11-09-2008)

  4. #3
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    133
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default

    found it, thanks for answering at least lol
    http://www.insanecombat.com << bored? check out ma game

Bookmarks

Posting Permissions

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