$total=mysql_query("select * from laborator where student='".$email."'");
$suma=0;$medie=0;$nr_note=0;
while($student=mysql_fetch_array($total))
{
if($student['nota']<=4)
{$medie=4; }
else {
$suma+=$student['nota'];
$nr_note++;
$medie=$suma/$nr_note;
}
}
$medie=number_format($medie,2);
$update_laborator=mysql_query("update laborator set nota=".$nota." where titlu='".$laborator."' and student='".$email."'");
$update_laborator1=mysql_query("update laborator set incercari=".$incercari." where titlu='".$laborator."' and student='".$email."'");
$update_laborator2=mysql_query("update laborator set promovat=".$promovat." where titlu='".$laborator."' and student='".$email."'");
$update_users=mysql_query("update users set media=".$medie." where email='".$email."'");