php - Store and add value to variables -
i'm new php , wanted make basic slot machine, when winning number equal user number "money" variable (fake money) doesn't add +10. stays @ 50.
i have made if statement , user number generated rand()
, $currentvalue = $money + 10;
isn't working.
i'm doing wrong, what?
example of if statement:
if($winnr == $usrnr) { echo 'you won!'; $currentvalue = $money + 10; } else { echo 'oops, try again'; echo '<button onclick="window.location.reload()">try again</button>'; $currentvalue = $money - 10; }
assuming have way store $money
between page calls (i.e. session), here's how save it
if($winnr == $usrnr) { echo 'you won!'; $money += 10; } else { echo 'oops, try again'; echo '<button onclick="window.location.reload()">try again</button>'; $money -= 10; }
Comments
Post a Comment