<?
$q=mysql_query("SELECT * FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0' LIMIT 20");
while($post=mysql_fetch_array($q))
{
if($post['time']>=$time)
{
$nt=$time-$post['last_rf'];
}
else
{
$nt=$post['time']-$post['last_rf'];
}
if($nt<0)$nt=0;
mysql_query("UPDATE `kolhoz_petground` SET `time_money2` = '".($post['time_money2']+$nt)."', `last_rf` = '$time' WHERE `id` = '$post[id]' AND `id_user` = '$ku[id]' LIMIT 1");
}
?>