newttster Posted October 9, 2011 Share Posted October 9, 2011 (edited) I have been able to get this to work in so far as it adds the silver flakes and reduces the digs by one. I have tried umpteen different ways to try and get the mine_exp to update and it won't. I realize that I need a qualifier in there stating that if the $randsf > 0 it should add the exp ... so far I haven't been able to get that to work. The fields I have for this are mine_exp, mine_level, and mine_max. Mine_max is supposed stays at 100 and each time there is a successful mine the exp_mine is supposed to increment by one. If the mine_exp exceeds the mine_max then it should add 1 level to mine_level. Any ideas or suggestions? function mine_one() { global $db,$ir,$c,$userid,$h; $randsf=rand(0,10); $gain=(1); if($ir['digs']<=0) { echo"<center>You don't have any digs left. Come back at reset.</center>"; $h->endpage(); exit; } if($ir['mine_exp']>$ir['mine_max']) { $db->query("UPDATE `users` SET `mine_level`=`mine_level` + 1 WHERE `userid`= '$userid'"); } else { $db->query("UPDATE `users` SET `mine_exp`=`mine_exp` + ". $gain .",`digs`=`digs`-1 WHERE `userid` = '$userid'"); item_add($userid, 566, $randsf); echo "<center>You begin mining in the Level 1 mineshaft and found '$randsf' silver flake(s).</center><br />"; echo"<center><a href='mineshaft.php?action=mineone'>Mine Again</a></center><br /> <a href='mineshaft.php'>Back</a></center>"; } } $h->endpage(); ?> Edited October 10, 2011 by newttster Quote Link to comment Share on other sites More sharing options...
chicka Posted October 9, 2011 Share Posted October 9, 2011 for starters $db->query("UPDATE `users` SET `mine_level`=`mine_level` + 1 WHERE `userid`= = '$userid'"); should be $db->query("UPDATE `users` SET `mine_level`=`mine_level` + 1 WHERE `userid`= '$userid'"); Quote Link to comment Share on other sites More sharing options...
newttster Posted October 10, 2011 Author Share Posted October 10, 2011 for starters $db->query("UPDATE `users` SET `mine_level`=`mine_level` + 1 WHERE `userid`= = '$userid'"); should be $db->query("UPDATE `users` SET `mine_level`=`mine_level` + 1 WHERE `userid`= '$userid'"); That was a mistype on my part when adding the code here. Fixed. The other issues I still have not been able to fix though. Quote Link to comment Share on other sites More sharing options...
newttster Posted October 11, 2011 Author Share Posted October 11, 2011 Fixed. Got it working! Quote Link to comment 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.