Jump to content

quick help with query


seany123

Recommended Posts

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

$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 ));

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.