first time here. I have found many useful stuff from this site, but im stuck right now.
I need help with the following code. I want this code to check every ID stats[population, populationgrowth], do the calculation which you can find in IF function and then insert result which is populationgrowth for each ID. It's a cronjob.
$get_users = mysql_query("SELECT * FROM stats") or die(mysql_error());
while($user = mysql_fetch_assoc($get_users)){
if($stats['population'] > $stats['maxpopulation']) {
$populationgrowth = 0;
}
else{
$populationgrowth = 1 * ($unit['moonhut']);
}
$update = mysql_query("UPDATE stats SET populationgrowth='".$populationgrowth."' WHERE id='".$user['id']."'") or die(mysql_error());
}