Jump to content
xisto Community

mingkus

Members
  • Content Count

    3
  • Joined

  • Last visited

  1. You just said everything I wanted to say lol xD
  2. In this code I want to retrieve the energy and max energy of a players account, then add 8% to energy of maxenergy, hen if energy is bigger than maxenergy, energy is then made equal to maxenergy. Then the database is updated.I don't understand why it's not working. $query=mysql_query("SELECT MAX(id) as maxid FROM `accounts` LIMIT 1");$row = mysql_fetch_assoc($query);$id = $row['maxid']; $query = "SELECT * FROM `accounts`"; $result=mysql_query($query);while ($row=mysql_fetch_assoc($result)) {$energy = $row['energy'];$maxenergy = $row['maxenergy'];}for($i=1; $i<="$id"; $i++) {$query = "SELECT * FROM `accounts` WHERE (id) = '".$id."'";$result=mysql_query($query);$addenergy = (0.08 * $maxenergy);$energy = ($addenergy + $energy);if($energy > $maxenergy) {$energy = $maxenergy;}$query = "UPDATE `account` SET (energy) = '".$energy."' WHERE (id) = '".$id."'";$result = mysql_query($query);echo" The energy script worked!";}
  3. Title says it all really.Just wondering if it's possible in an way? If so could anyone tell me?
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.