Jump to content

Parse error: syntax error, unexpected T_ELSE in /home/monk3h/public_html/box.php


Monk3h

Recommended Posts

This error has been annoying for far too long now.. Stupid little things keep going wrong with my script when i change the slightest things and i have no idea why!?

 

Heres the Code:

 

<?php $title = "The Safety Deposit Boxes"; include ("header.php"); ?>

<?php
if ($stat[travelpass] <= N ) {

Print "<b>Dusty old man:</b> You shouldnt be down here without a Travel Pass! Shoo, before i get you banned from here Completely!";
}
else {

		Print "<b>Dusty old man:</b> Welcome the Safety Deposit Box Area, not many people come down here anymore.. Well then, Whats ya business?";

print "<ul>";
	print "<li><a href=box.php?action=box>Open a box</a>";
	print "</ul>";

if ($action == box) {

$chance = rand(1,;
	mysql_query("update players set keys=keys-1 where id=$stat[id]");
	if ($chance == 1) {
		print "As you turn the key in the lock you here a faint fluttering sound.. Nothing here but butterflies!";
	}
	if ($chance == 2) {
		print "You found a <i>Diamond!</i>.. No wait, thats just a shiney rock.";
	}
	if ($chance == 3) {
		$crgain = rand(1,10000);
		print "Credits, millions of them! <b>$crgain</b> to be more precise.";
		mysql_query("update players set credits=credits+$crgain where id=$stat[id]");
	}
	if ($chance == 4) {
		print "Nothin' interesting can be seen.";
	}
	if ($chance == 5) {
		print "What was that?";
	}
	if ($chance == 6) {
		$plgain = rand(1,100);
		print "Pft.. Just a lump of ore.. No wait! Thats no ordinary ore! You found <b>$plgain</b> platinum.";
		mysql_query("update players set platinum=platinum+$plgain where id=$stat[id]");
	}
	if ($chance == 7) {
		$roll = rand(1,20);
		if ($roll == 15) {
			print "As you open the box door the stench of Stagnent Water overwhelms your sences! Inside you fine a vile or murky liquid.";
			mysql_query("update players set elixer=elixer+1 where id=$stat[id]");
		} else {
			print "Ewwwwww! its a dead fish! Cant of been here for long as it seems to still be edible! <b>1</b> Bass gained!";
			mysql_query("update players set bass=bass+1 where id=$stat[id]");
		}
	}
	if ($chance ==  {
		print "The key breaks off in the lock..";
	}
	$keysleft = ($stat[keys] - 1);
	print "<br><br>... <a href=box.php?action=box>Open</a> another box? (<b>$keysleft</b> Keys left.)";

}

} else {

print "<b>Dusty old man:</b> You dont have the key for that box, infact you dont have a key for any of these Boxes, get outa here! <br><br> <a href=travel.php>Leave</a>";

}
?>
<?php include("footer.php"); ?>

this is the problem in bold

 

 

 

if ($stat[travelpass] <= N ) {

 

Print "Dusty old man: You shouldnt be down here without a Travel Pass! Shoo, before i get you banned from here Completely!";

}

else {

 

        Print "Dusty old man: Welcome the Safety Deposit Box Area, not many people come down here anymore.. Well then, Whats ya business?";

 

 

 

 

--------------

 

 

you can just have an "else" keyword on its own line...try this:

 

} else {

this is the problem in bold

 

 

 

if ($stat[travelpass] <= N ) {

 

Print "Dusty old man: You shouldnt be down here without a Travel Pass! Shoo, before i get you banned from here Completely!";

}

else {

 

         Print "Dusty old man: Welcome the Safety Deposit Box Area, not many people come down here anymore.. Well then, Whats ya business?";

 

 

 

 

--------------

 

 

you can just have an "else" keyword on its own line...try this:

 

} else {

 

Indeed it is pefectly valid sytax to use...

 

if ($exp) {
  // do something
}
else {
// do something else.
}

this is the problem in bold

 

 

 

if ($stat[travelpass] <= N ) {

 

Print "Dusty old man: You shouldnt be down here without a Travel Pass! Shoo, before i get you banned from here Completely!";

}

else {

 

        Print "Dusty old man: Welcome the Safety Deposit Box Area, not many people come down here anymore.. Well then, Whats ya business?";

 

 

 

 

--------------

 

 

you can just have an "else" keyword on its own line...try this:

 

} else {

 

Indeed it is pefectly valid sytax to use...

 

if ($exp) {
  // do something
}
else {
// do something else.
}

 

 

Hmm....I've tried that before and got a similar error...thats why i thought it was invalid

Changing it to

 

}

else {

 

Just moved the error down a line.. :/

 

the if ($stat[travelpass] <= N ) { is the make sure the user has the pass needed to be in that area..

 

 

Edit: I missunderstood what you said and have tried chaging both Else to

 

} else {

 

and

 

}
else {

 

 

Nether worked.. :(

Too keep things clear..

 

<?php $title = "The Safety Deposit Boxes"; include ("header.php"); ?>

<?php
if ($stat[travelpass] <= N ) {

Print "<b>Dusty old man:</b> You shouldnt be down here without a Travel Pass! Shoo, before i get you banned from here Completely!";

} else {
		Print "<b>Dusty old man:</b> Welcome the Safety Deposit Box Area, not many people come down here anymore.. Well then, Whats ya business?";

print "<ul>";
	print "<li><a href=box.php?action=box>Open a box</a>";
	print "</ul>";

if ($action == box) {

$chance = rand(1,;
	mysql_query("update players set keys=keys-1 where id=$stat[id]");
	if ($chance == 1) {
		print "As you turn the key in the lock you here a faint fluttering sound.. Nothing here but butterflies!";
	}
	if ($chance == 2) {
		print "You found a <i>Diamond!</i>.. No wait, thats just a shiney rock.";
	}
	if ($chance == 3) {
		$crgain = rand(1,10000);
		print "Credits, millions of them! <b>$crgain</b> to be more precise.";
		mysql_query("update players set credits=credits+$crgain where id=$stat[id]");
	}
	if ($chance == 4) {
		print "Nothin' interesting can be seen.";
	}
	if ($chance == 5) {
		print "What was that?";
	}
	if ($chance == 6) {
		$plgain = rand(1,100);
		print "Pft.. Just a lump of ore.. No wait! Thats no ordinary ore! You found <b>$plgain</b> platinum.";
		mysql_query("update players set platinum=platinum+$plgain where id=$stat[id]");
	}
	if ($chance == 7) {
		$roll = rand(1,20);
		if ($roll == 15) {
			print "As you open the box door the stench of Stagnent Water overwhelms your sences! Inside you fine a vile or murky liquid.";
			mysql_query("update players set elixer=elixer+1 where id=$stat[id]");
		} else {
			print "Ewwwwww! its a dead fish! Cant of been here for long as it seems to still be edible! <b>1</b> Bass gained!";
			mysql_query("update players set bass=bass+1 where id=$stat[id]");
		}
	}
	if ($chance ==  {
		print "The key breaks off in the lock..";
	}
	$keysleft = ($stat[keys] - 1);
	print "<br><br>... <a href=box.php?action=box>Open</a> another box? (<b>$keysleft</b> Keys left.)";

}

} else {

print "<b>Dusty old man:</b> You dont have the key for that box, infact you dont have a key for any of these Boxes, get outa here! <br><br> <a href=travel.php>Leave</a>";

}
?>
<?php include("footer.php"); ?>

 

Error: Parse error: syntax error, unexpected T_ELSE in /home/monk3h/public_html/box.php on line 59

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.