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"); ?>

Link to comment
Share on other sites

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 {

Link to comment
Share on other sites

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.
}

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.. :(

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.