R1der Posted January 12, 2007 Share Posted January 12, 2007 i get this error from this code. Can anyone help with this?Parse error: syntax error, unexpected ')' in /****/******/*****/****.php on line 2[code]while($youdata > 0 && $odata >){ $opponents_health -= random(5,10);}[/code]Thx Quote Link to comment https://forums.phpfreaks.com/topic/33942-error/ Share on other sites More sharing options...
GingerRobot Posted January 12, 2007 Share Posted January 12, 2007 while($youdata > 0 && $odata >)Your while statment is incompete. There is nothing for $odata to be greater than. Quote Link to comment https://forums.phpfreaks.com/topic/33942-error/#findComment-159362 Share on other sites More sharing options...
R1der Posted January 12, 2007 Author Share Posted January 12, 2007 But i am sure even if it was that. it would'nt cause this error Quote Link to comment https://forums.phpfreaks.com/topic/33942-error/#findComment-159364 Share on other sites More sharing options...
Psycho Posted January 12, 2007 Share Posted January 12, 2007 [quote author=R1der link=topic=122152.msg503394#msg503394 date=1168630252]But i am sure even if it was that. it would'nt cause this error[/quote]You may be sure, but you are wrong. The error states "unexpected ')'" because when parsing the code it comes to the closing paren without finding a value to compare $odata to. Makes perfect sense. Quote Link to comment https://forums.phpfreaks.com/topic/33942-error/#findComment-159367 Share on other sites More sharing options...
R1der Posted January 12, 2007 Author Share Posted January 12, 2007 No because i fixed that and still get the same error Quote Link to comment https://forums.phpfreaks.com/topic/33942-error/#findComment-159370 Share on other sites More sharing options...
GingerRobot Posted January 12, 2007 Share Posted January 12, 2007 Can you please show us the new code then? Quote Link to comment https://forums.phpfreaks.com/topic/33942-error/#findComment-159371 Share on other sites More sharing options...
R1der Posted January 12, 2007 Author Share Posted January 12, 2007 [code]while( $youdata > 0 && $odata > 0){ $opponents_health -= random(5,10);}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/33942-error/#findComment-159377 Share on other sites More sharing options...
GingerRobot Posted January 12, 2007 Share Posted January 12, 2007 Well that code should not produce the error you have given at the moment. Im assuming that you have cut something out of the while statement otherwise that will produce an error - as at the moment it will enter an infinite loop.Are you sure you are still getting the exact same error? Quote Link to comment https://forums.phpfreaks.com/topic/33942-error/#findComment-159382 Share on other sites More sharing options...
redbullmarky Posted January 12, 2007 Share Posted January 12, 2007 shouldnt you also use [url=http://www.php.net/rand]rand[/url] rather than 'random' ? or have you got a custom function called 'random' ? Quote Link to comment https://forums.phpfreaks.com/topic/33942-error/#findComment-159384 Share on other sites More sharing options...
R1der Posted January 12, 2007 Author Share Posted January 12, 2007 yes i am still getting the error and no i did'nt cut any of the code out.Also that is a good point about random lol Quote Link to comment https://forums.phpfreaks.com/topic/33942-error/#findComment-159398 Share on other sites More sharing options...
GingerRobot Posted January 12, 2007 Share Posted January 12, 2007 So your code is just:[code]<?phpwhile( $youdata > 0 && $odata > 0){ $opponents_health -= rand(5,10);}[/code]With nothing else before the start of this? If so i dont really understand. There is no syntax error there Quote Link to comment https://forums.phpfreaks.com/topic/33942-error/#findComment-159411 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.