i got a problem about calculation... this is my problem... $score = 0; //this is come form random choose by computer. if(condition) { $result = 1; } elseif(condition) { $result = -1; } else { $result = 0; } //calculate the value of result as score. $score +=$result i want to this repeat calculate as long as i need... but i need the $score will be change value to the next calculation. example; //first calculate $score = 0 $result= 1 so $score +=$result = 0+1 = 1 //second calculation $score=1 //come from first calculation $result=1 =2 //third calculation $score =2 //come from second calculation $result=-1 =1 so how do i change the value of $score after calculation to be the total value and bring it to the next operation. please help me... i have try so many time but i don't, how to change it.... the value of $score do not change..... thanks.....
use while loop if you have limited the game, i mean if some ones time over then it should stop like this .. while(time is over) { your whole calculation code here } or use if to check $score .... if($_POST['score'] === 0) { $score = 0} put it on top of your calculation code. and other code is ok.
thanks for this suggestion.... can u explain me more about how to limit the game...? if i limited the game only 1 minute.... how do i does it..... and calculate the score?... please.... thanks...
i did not see your game, and i am not aware what you have done till now, i use limit word as a example, so it doesn't needed ...
ooo... my game is a simple one.... player just choose three character like A,B and C. the computer also choose that...A,B and C randomly. the score is come after the game.... if player win.... they get 1 point lose..... -1 point and if draw...0 point. so, if i set the game is only 5 round, how do i set the time limit of that?...
just declear a function for that or a session variable for countng rounds, when some one played 5 rounds, session variable will have value of 5, give a condition if session variable has 5, than stop the game as you want ... see a simple example $_SESSION['round'] += 1; if($_SESSION['round']==5) { header('Location: Finalscore.php'); exit; } in finalscore.php you can unset session . i hope you got it . please correct if any thing wrong, i just wrote a code here from my sense, i did not try it so correct it if any thing goes wrong Thanks