Parsing the mysql results you could create an array with your results something like this:
$results['senior'][0] = array('name'=>'John Spencer',..);
$results['senior'][1] = array('name'=>'...',..);
...
$results['senior'][n] = array('name'=>'...',..);
$results['pastoral'][0] = array('name'=>'Bob Rockwell',..);
$results['pastoral'][1] = array('name'=>'Joe Prestridge',..);
...
$results['pastoral'][m] = array('name'=>'...',..);
$results['other_group'][0] = array('name'=>'...',..);
...
$results['other_group'][k] = array('name'=>'...',..);
Creating this array is not so hard, you can do it something like this:
$results = array();
while ($rows= mysql_fetch_assoc($result)){
$categ = $rows['category']; unset($rows['category']);
$results[$categ][] = $rows;
}
this will produce the array I listed above ...
Using a [man]foreach[/man] you can easily output your results the way you want ...