$battlemobs=mysql_query("SELECT * FROM `battle_2` WHERE `Id_ac`='".$account['id']."'");
while($resmob=mysql_fetch_assoc($battlemobs)){
$attackcol=floor((time()-$resmob['last_damag'])/$resmob['damag_every_sec']);
for($i=1;$i<=$attackcol;$i++){
$damagmob=10;
$hpdm=$account['hp']-$damagmob;
if ($hpdm<0){
$hpdm=0;
mysql_query("DELETE FROM `battle_2` WHERE `Id_ac`='".$account['id']."'");
echo '<font color="#3d060c">Бой окончен. Вы проиграли...</font>';
echo ''.$account['id'].'';
down();
exit;
}
mysql_query("UPDATE `account` SET `hp`='".$hpdm."' WHERE `id`='".$account['id']."'");
mysql_query("INSERT INTO `battle_log` (`account`, `mess`)VALUES('".$account['id']."',
'<img src=\"/data/img/skill/attack.jpg\" width=\"10px\" height=\"10px\"><font color=\"#3d060c\">".$resmob['name']." наносит вам ".$damagmob." урона!</font>')");
mysql_query("UPDATE `battle_2` SET `last_damag`='".time()."' WHERE `Id_ac`='".$account['id']."'");
$account['hp']=mysql_result(mysql_query("SELECT `hp` FROM `account` WHERE
`id`='".$account['id']."'"),0);
}
}