$group=1 ;
$sqledit= "select * from school where subjects='$codesu' order by gpa, pre desc";
$resultedit=mysql_query($sqledit);
$numrows=mysql_num_rows($resultedit);
while ($fetchedit=mysql_fetch_array($resultedit)){
$dbid=$fetchedit['id'];
$sql= " UPDATE school SET groupstu='$group' WHERE id='$dbid'";
$result=mysql_query($sql);
if( $group==$groupstu ){$group=0;}
$group++ ;
}