I want to create a general class that checks the session user experience.
Experience Variables:
$level1 = 0;
$level2 = 50;
$level3 = 100;
...
My question and goal is to create something of the sort:
if user tiver 0 exp, add lvl1
if user tiver 50 exp, add lvl2
if user tiver 100 exp, add lvl3
....
So I started to create this way, but whenever I do refresh it always adds +1 level. I wanted to add only 1x when having that experience:
if($level) {
$level1 = 0;
$level2 = 50;
$level3 = 100;
$level4 = 150;
$level5 = 200;
$level6 = 250;
$level6 = 300;
if($exp == $level2) {
$update1 = "UPDATE users_steam SET level = level + '1' WHERE steamid = '$steamid'";
$result1 = $db->query($update1);
} else if($exp == $level3) {
$update2 = "UPDATE users_steam SET level = level + '1' WHERE steamid = '$steamid'";
$result2 = $db->query($update2);
}
}
How can I make it stop when I check the experiment and add the new level?