Thanks for your quick replies.
Currently, I loop thorugh an array to create value lists. I would like to change this so it loops through a list:
Here is my code for the array:
$valuelists = array();
$i = 0;
foreach($grouparray as $value)
{
$valuelists[$i] = "('".$value."', '".$pupilid."')";
$i++;
}
$insert = "INSERT INTO tblpupilgroup(groupID, pupilID) VALUES";
$insert .= implode(",",$valuelists);