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 )); 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 )); Link to comment https://forums.phpfreaks.com/topic/156245-quick-help-with-query/#findComment-822568 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.