I have a php file that I run via cron. For testing I've set it to run every hour, but normally it will run once a day. What I want is to make it so that if the player has the autotechrefinery field set to 1, then they should have their population pulled from the table, how much money, research supplies, and technology they have.
From there, what I want is to deduct 500 researchsupplies, add 50 technology, and deduct 10% of population from money. All of this seems to be working when I run the file manually, but when I let it run automatically via cron, there is something that isn't working that as a result it sets technology to 50, researchsupplies to -500 and money to 0.
$refCheck = mysql_query("SELECT * FROM players WHERE autotechrefinery='1'");
while($rC = mysql_fetch_array($refCheck)) {
$nation = $rC['nation'];
$pop = $rC['population'];
$rsupplies = $rC['researchsupplies'];
$cash = $rC['money'];
$tech = $rC['technology'];
$newtech = $tech+50;
$newmoney = $cash-($pop*.1);
$newsupplies = $rsupplies-500;
mysql_query("UPDATE players SET money='$newmoney', technology='$newtech', researchsupplies='$newsupplies', techbought='1' WHERE autotechrefinery='1'"); }