R1der Posted October 12, 2006 Share Posted October 12, 2006 (Hey Hey i am back again but one of my mess ups lol) ok i am getting this errorParse error: parse error, unexpected T_ELSE in /home/fhlinux202/h/hcn-chat.com/user/htdocs/game/play/mine2.php on line 27[code]<?phpif(!$_GET['stp']){?><b>You walk into the mine and see loads of rocks..<br><a href="mine2.php?stp=bronze">Mine with bronze pickaxe</a><br><?php}elseif($_GET['stp'] == "bronze"){if($user['uAttackTurns'] <= 4){echo "You Dont have enough Energy to mine."; exit;}if($user['uPickaxe']=='0'){echo "You need a pickaxe to mine gems.";exit;}$rand = rand(1,20);if($rand==1 || $rand==5 || $rand==10 || $rand==15 || $rand==20 || $rand==25) {$rand_gems = rand(1,5);echo "You start to mine with your bronze pickaxe and find $rand_gems gem(s).";else{echo "You find nothing but bits of useless rock";$db->query("UPDATE users SET uGems=uGems+'$rand_gems' WHERE uID='" . $user['uID'] . "'");}}?><a href="mine2.php?stp=bronze"><br>Mine again</a><br><?[/code]Now personaly i dont see a problem in the else statement and i been trying to sort it now for almost a hour.Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/23742-help-me-please-again/ Share on other sites More sharing options...
R1der Posted October 12, 2006 Author Share Posted October 12, 2006 Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/23742-help-me-please-again/#findComment-107820 Share on other sites More sharing options...
JasonLewis Posted October 12, 2006 Share Posted October 12, 2006 could you try putting the } before the else near the bottom? if it dont work i'll read it a bit better. :P Quote Link to comment https://forums.phpfreaks.com/topic/23742-help-me-please-again/#findComment-107821 Share on other sites More sharing options...
R1der Posted October 12, 2006 Author Share Posted October 12, 2006 Hey thanks for your reply projectBut that didn't solve my problem. :( Quote Link to comment https://forums.phpfreaks.com/topic/23742-help-me-please-again/#findComment-107822 Share on other sites More sharing options...
R1der Posted October 12, 2006 Author Share Posted October 12, 2006 Guys i really need help here. i need this script to go live today. and i have more coding to add to it. :-\Sorry to stress but this is kinda important. Quote Link to comment https://forums.phpfreaks.com/topic/23742-help-me-please-again/#findComment-107833 Share on other sites More sharing options...
kenrbnsn Posted October 12, 2006 Share Posted October 12, 2006 You're missing a closing "}" on this "if" statement:[code]<?phpif($rand==1 || $rand==5 || $rand==10 || $rand==15 || $rand==20 || $rand==25) {$rand_gems = rand(1,5);echo "You start to mine with your bronze pickaxe and find $rand_gems gem(s).";} // <--- insert this missing closing curly bracketelse{ ?>[/code]If you indent your code correctly this would have been very apparent.Ken Quote Link to comment https://forums.phpfreaks.com/topic/23742-help-me-please-again/#findComment-107835 Share on other sites More sharing options...
R1der Posted October 12, 2006 Author Share Posted October 12, 2006 I still get the same error. Parse error: parse error, unexpected T_ELSE in /home/fhlinux202/h/hcn-chat.com/user/htdocs/game/play/mine2.php on line 27[code]<?phpif(!$_GET['stp']){?><b>You walk into the mine and see loads of rocks..<br><a href="mine2.php?stp=bronze">Mine with bronze pickaxe</a><br><?php}elseif($_GET['stp'] == "bronze"){if($user['uAttackTurns'] <= 4){echo "You Dont have enough Energy to mine."; exit;}if($user['uPickaxe']=='0'){echo "You need a pickaxe to mine gems.";exit;}$rand = rand(1,20);if($rand==1 || $rand==5 || $rand==10 || $rand==15 || $rand==20 || $rand==25) {$rand_gems = rand(1,5);echo "You start to mine with your bronze pickaxe and find $rand_gems gem(s).";else{echo "You find nothing but bits of useless rock";}$db->query("UPDATE users SET uGems=uGems+'$rand_gems' WHERE uID='" . $user['uID'] . "'");}}?><a href="mine2.php?stp=bronze"><br>Mine again</a><br>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23742-help-me-please-again/#findComment-107836 Share on other sites More sharing options...
HuggieBear Posted October 12, 2006 Share Posted October 12, 2006 You still haven't pasted in the closing curley brace!Try this:[code]<?phpif(!$_GET['stp']){?><b>You walk into the mine and see loads of rocks..<br><a href="mine2.php?stp=bronze">Mine with bronze pickaxe</a><br><?php}elseif($_GET['stp'] == "bronze"){ if($user['uAttackTurns'] <= 4){ echo "You Dont have enough Energy to mine."; exit; } if($user['uPickaxe']=='0'){ echo "You need a pickaxe to mine gems."; exit; } $rand = rand(1,20); if($rand==1 || $rand==5 || $rand==10 || $rand==15 || $rand==20 || $rand==25){ $rand_gems = rand(1,5); echo "You start to mine with your bronze pickaxe and find $rand_gems gem(s)."; } else{ echo "You find nothing but bits of useless rock"; $db->query("UPDATE users SET uGems=uGems+'$rand_gems' WHERE uID='" . $user['uID'] . "'"); }}?><a href="mine2.php?stp=bronze"><br>Mine again</a><br>[/code]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/23742-help-me-please-again/#findComment-107838 Share on other sites More sharing options...
R1der Posted October 12, 2006 Author Share Posted October 12, 2006 That fixed the error but now it dont update the database with the $rand_Gems Quote Link to comment https://forums.phpfreaks.com/topic/23742-help-me-please-again/#findComment-107870 Share on other sites More sharing options...
HuggieBear Posted October 12, 2006 Share Posted October 12, 2006 It won't, you have your code in the wrong place...Move this:[code=php:0]$db->query("UPDATE users SET uGems=uGems+'$rand_gems' WHERE uID='" . $user['uID'] . "'");[/code]Inside here:[code]<?phpif($rand==1 || $rand==5 || $rand==10 || $rand==15 || $rand==20 || $rand==25){ $rand_gems = rand(1,5); echo "You start to mine with your bronze pickaxe and find $rand_gems gem(s).";}?>[/code]You currently have it updating the database if they don't find the gems, not if they do :)RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/23742-help-me-please-again/#findComment-107873 Share on other sites More sharing options...
R1der Posted October 12, 2006 Author Share Posted October 12, 2006 That worked. wow so simple :PThanks again :) Quote Link to comment https://forums.phpfreaks.com/topic/23742-help-me-please-again/#findComment-107875 Share on other sites More sharing options...
HuggieBear Posted October 12, 2006 Share Posted October 12, 2006 Anytime my friend :)Huggie Quote Link to comment https://forums.phpfreaks.com/topic/23742-help-me-please-again/#findComment-107876 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.