I am trying to assign a value to a field in a database in groups of 25. For example, the first 25 are assigned the value of 1, the next 25 a value of 2 etc. I have tried to do this but I end up just looping through the whole thing giving everyone the same number.
Here is what I have so far...
$i = 1;
while(($count > 0) && ($i < 10)){
$sql = "UPDATE tbl_studentModules SET groupID = $i WHERE groupID = '' LIMIT 25";
$result = mysql_query($sql) or die(mysql_error());
$count = mysql_num_rows($result);
$i++;
}
Any help will be gratefully received.
Thanks