Cron Job (Resolved)
Posted: Sun Aug 25, 2013 1:31 am
Hey all... Trying to make a max turn work on the cron..... What's wrong with my code please ?
EDIT:
Well firstly I edited:
To be this:
But not go 
Code: Select all
<?php
include("functions.php");
connect();
$get_users = mysql_query("SELECT * FROM `stats`") or die(mysql_error());
while($user = mysql_fetch_assoc($get_users)){
$update = mysql_query("UPDATE `stats` SET
`gold`=`gold`+'".$user['income']."',
`food`=`food`+'".$user['farming']."',
`turns`=`turns`+'5' WHERE `id`='".$user['id']."'") or die(mysql_error());
$update = mysql_query("UPDATE `stats` SET
`turns`=`turns`+'5' WHERE `id`='".$user['id']."'") or die(mysql_error());
}
if(!isset($_SESSION['uid'])){
}else{
if ($stats['turns'] > $stats['maxturns']) {
$update = mysql_query("update stats set maxturns = $stats[maxturns] WHERE id='$id'") or die ("Could not update player");
}
}
?>Well firstly I edited:
Code: Select all
$update = mysql_query("update stats set maxturns = $stats[maxturns] WHERE id='$id'") or die ("Could not update player");Code: Select all
$update = mysql_query("update stats set turns= $stats[maxturns] WHERE id='$id'") or die ("Could not update player");