...

View Full Version : HELP: syntax error, unexpected '(' in......



2Pacalypse
03-26-2009, 07:53 PM
<?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'] > 0 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'] > 4 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'] > 9 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?

steelaz
03-26-2009, 07:57 PM
Function name can't start with number

2Pacalypse
03-26-2009, 08:02 PM
Lol, thanks alot, perfect fix :D

businessman2000
03-27-2009, 04:26 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum