Using math to update the database

More often then not, you’re going to want to do some math. Whether it’s giving pets realtime needs or some sort of daily rewards system, the database needs to know how to math. Go to class_database.php and add this: Pastebin link

Here are the examples IntoRain gave on how these can now be used in scripts:

//decrease mood of every owned adoptable by 2
$mysidia->db->update_decrease(“owned_adoptables”, array(“mood”), 2);

//decrease mood and totalclicks by 1, when an adoptable has totalclicks = 1
$mysidia->db->update_decrease(“owned_adoptables”, array(“mood”, “totalclicks”), 1, “totalclicks = 1”);

Advertisements

Powered by WordPress.com.

Up ↑

%d bloggers like this: