I have a problem with refreshing PHP variable... PHP variable after refreshing is still same - not refreshed
My little JS:
var reload = function() {
var pred = <?php Echo json_encode(reload()); ?>;
$(".reload").fadeIn("fast").text(pred);
setTimeout(reload, 3000);
}
setTimeout(reload, 3000);
My PHP function:
function reload() {
ForEach ($servers as $server) {
$s = Explode(":", $server);
$Data = $status->getStatus($s[0], $s[1]);
If (!$Data) {} Else { $c1 = $c1 + $Data['Players']; }
}
Return $c1; //Players returned
}
If I joined the game after during this script the variable is the same as on beggining... Nothing was changed. Why my variable isn't refreshing ? What am I doing wrong?
Thanks for all help and sorry for my bad eng