Im creating a game… I have the database and everything set up to work and things are writing to it. In this case a crew business and it’s daily payout. When the business is purchased it’s posting to the database the purchase and payout like it should and setting a timer. All is well with that. But come payout time it takes a nose dive and does nothing… here is the code in question… any help would be appreciated.
if ($crew->payout <= time()){
$bus=explode("-", $crew->income);
$first = $bus[0] * 1000000;
$second = $bus[1] * 2000000;
$third = $bus[2] * 4000000;
$total = $first+$second+$third;
$total_users = mysql_num_rows(mysql_query("SELECT * FROM users WHERE crew='$crew->name'"));
$per_user=round($total / $total_users);
$add=mysql_query("SELECT * FROM users WHERE crew='$crew->name'");
while($it = mysql_fetch_object($add)){
$new_money = $it->money + $per_user;
mysql_query("UPDATE users SET money='$new_money' WHERE username='$it->username'");
$new_payout = time() + (3600*24);
mysql_query("UPDATE crews SET payout='$new_payout' WHERE name='$crew->name'");
}}
?>