PDA

View Full Version : Why wont this code work?



Demonicman
11-09-2008, 08:29 AM
Here is my 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

JasonDFR
11-09-2008, 08:43 AM
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:


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

Demonicman
11-09-2008, 08:55 AM
found it, thanks for answering at least lol