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 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    96
    Thanks
    4
    Thanked 0 Times in 0 Posts

    HELP: syntax error, unexpected '(' in......

    PHP Code:
    <?php
    switch($_GET['city'])
    {
    case 
    '1'1(); break;
    case 
    '2'2(); break;
    case 
    '3'3(); break;
    case 
    '4'4(); break;
    case 
    '5'5(); break;
    case 
    '6'6(); break;
    case 
    '7'7(); break;
    }
    include 
    "globals.php";

    function 
    1()
    {
    if (
    $ir['level'] > and $ir['money'] >999)
    {
    $db->query("UPDATE users SET money=money-1000,location=1 WHERE userid=$userid");
    print 
    "You paid /$1,000 to travel to Portadown";
    }
    elseif (
    $ir['level'] < 1)
    {
    print 
    "You are not high enoguh level to go here!";
    }
    elseif (
    $ir['money'] < 1000)
    {
    print 
    "You don't have enough money to cover the ticket";
    }
    }

    function 
    2()
    {
    if (
    $ir['level'] > and $ir['money'] >2999)
    {
    $db->query("UPDATE users SET money=money-3000,location=2 WHERE userid=$userid");
    print 
    "You paid /$3,000 to travel to London";
    }
    elseif (
    $ir['level'] < 5)
    {
    print 
    "You are not high enough level to go here!";
    }
    elseif (
    $ir['money'] < 3000)
    {
    print 
    "You don't have enough money to cover the ticket";
    }
    }

    function 
    3()
    {
    if (
    $ir['level'] > and $ir['money'] >4999)
    {
    $db->query("UPDATE users SET money=money-5000,location=3 WHERE userid=$userid");
    print 
    "You paid /$5,000 to travel to Washington";
    }
    elseif (
    $ir['level'] < 10)
    {
    print 
    "You are not high enoguh level to go here!";
    }
    elseif (
    $ir['money'] < 5000)
    {
    print 
    "You don't have enough money to cover the ticket";
    }
    }

    function 
    4()
    {
    if (
    $ir['level'] > 19 and $ir['money'] >7499)
    {
    $db->query("UPDATE users SET money=money-7500,location=4 WHERE userid=$userid");
    print 
    "You paid /$7,500 to travel to Paris";
    }
    elseif (
    $ir['level'] < 20)
    {
    print 
    "You are not high enoguh level to go here!";
    }
    elseif (
    $ir['money'] < 7500)
    {
    print 
    "You don't have enough money to cover the ticket";
    }
    }

    function 
    5()
    {
    if (
    $ir['level'] > 29 and $ir['money'] >9999)
    {
    $db->query("UPDATE users SET money=money-10000,location=5 WHERE userid=$userid");
    print 
    "You paid /$10,000 to travel to Berlin";
    }
    elseif (
    $ir['level'] < 30)
    {
    print 
    "You are not high enough level to go here!";
    }
    elseif (
    $ir['money'] < 10000)
    {
    print 
    "You don't have enough money to cover the ticket";
    }
    }

    function 
    6()
    {
    if (
    $ir['level'] > 39 and $ir['money'] >12499)
    {
    $db->query("UPDATE users SET money=money-12500,location=6 WHERE userid=$userid");
    print 
    "You paid /$12,500 to travel to Las Vegas";
    }
    elseif (
    $ir['level'] < 40)
    {
    print 
    "You are not high enough level to go here!";
    }
    elseif (
    $ir['money'] < 12500)
    {
    print 
    "You don't have enough money to cover the ticket";
    }
    }

    function 
    7()
    {
    if (
    $ir['level'] > 49 and $ir['money'] >14999)
    {
    $db->query("UPDATE users SET money=money-15000,location=7 WHERE userid=$userid");
    print 
    "You paid /$12,500 to travel to Kathmandu <br> This is a very cold place!";
    }
    elseif (
    $ir['level'] < 50)
    {
    print 
    "You are not high enough level to go here!";
    }
    elseif (
    $ir['money'] < 15000)
    {
    print 
    "You don't have enough money to cover the ticket";
    }
    }
    $h->endpage();
    ?>
    I just wrote this thing, so there's no problem posting it all, anyway.

    Can anyone tell me what's up doc?

  • #2
    New Coder
    Join Date
    Mar 2009
    Location
    Chicago, IL
    Posts
    69
    Thanks
    0
    Thanked 15 Times in 15 Posts
    Function name can't start with number

  • #3
    New Coder
    Join Date
    Jul 2008
    Posts
    96
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Lol, thanks alot, perfect fix

  • #4
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    3
    Thanks
    0
    Thanked 1 Time in 1 Post
    Just a general recommendation: I see you performing a lot of database work using raw variables. I would advise cleaning those before using those variables to interact with the database.


  •  

    Posting Permissions

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