<? 
$s=0;	
$rb=mysql_query("SELECT * FROM plateg WHERE id_akk='".$id_user."' ORDER BY data");
while($rrb=mysql_fetch_array($rb))
{
if($rrb['typ']==1)
	$s=$s+$rrb['summa'];
if($rrb['typ']==2)
	$s=$s-$rrb['summa'];
}
mysql_query("UPDATE akk SET summa='".$s."' WHERE id_akk='".$id_user."'");
?>
