Phpfr3ak Posted December 8, 2011 Share Posted December 8, 2011 Wondering what the heck is wrong with it, worked before i varied the error messages, had a pal check it out, he couldn't really spot anything wrong either, obviously were both being blind at what is missing, if someone would be kind enough to explain the segment of code that's causing the error is below. if ($amount < 1); echo "You must enter the number of troops you wish to hire."; exit; }else{ if ($amount > $maxdef); echo "You cannot hire over your housing limit."; exit; }else{ if ($amount = ""); echo "You must enter the number of troops you wish to hire."; exit; else if ($HireCost > $CashOnHand); echo "You do not have enough cash on hand to hire these troops."; exit; Quote Link to comment https://forums.phpfreaks.com/topic/252715-unexpected-t_else/ Share on other sites More sharing options...
scootstah Posted December 8, 2011 Share Posted December 8, 2011 You are using if/else incorrectly. You need to encase everything inside the conditional with curly braces. You are simply using a semicolon after the condition, which is incorrect. if ($amount < 1) { echo "You must enter the number of troops you wish to hire."; exit(); }else{ // blah blah } Quote Link to comment https://forums.phpfreaks.com/topic/252715-unexpected-t_else/#findComment-1295561 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.