seany123 Posted April 30, 2009 Share Posted April 30, 2009 just a quick bit of help... how could i edit this query so it will set Awake to 0 if awake - $awakeloss is smaller than 0 $query = $db->execute("update `players` set `energy`=?, `awake`=?, `strength`=?, `total`=? where `id`=?", array($player->energy - $_POST['energy_def'], $player->awake - $awakeloss3, $player->defense + $statgain3, $player->total + $statgain3, $player->id )); Quote Link to comment https://forums.phpfreaks.com/topic/156245-quick-help-with-query/ Share on other sites More sharing options...
sasa Posted April 30, 2009 Share Posted April 30, 2009 $query = $db->execute("update `players` set `energy`=?, `awake`=?, `strength`=?, `total`=? where `id`=?", array($player->energy - $_POST['energy_def'], ($player->awake - $awakeloss3) < 0 ? 0 : $player->awake - $awakeloss3, $player->defense + $statgain3, $player->total + $statgain3, $player->id )); Quote Link to comment https://forums.phpfreaks.com/topic/156245-quick-help-with-query/#findComment-822568 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.