Ok, let's look at this a bit closer
$sql = "SELECT s.uid, w.name as moviename, GROUP_CONCAT(p.id) as pids, GROUP_CONCAT(p.name SEPARATOR '|') as starring
FROM scenes s
LEFT JOIN people p ON s.personid = p.id
LEFT JOIN movies w ON s.movieid = w.id
GROUP BY s.movieid, s.sceneid
HAVING pids LIKE '$_GET[pid],%' OR pids LIKE '%,$_GET[pid]' OR pids LIKE '%,$_GET[pid],%'";
First off, I'd never use unescaped input data (like $_GET and $_POST) directly in a query, it could lead to all sorts of SQL injection bugs, or worse security holes. There's a ton of references on this sort of this so get googling (http://phpsec.org/ isn't a bad place to start). In this instance, assuming p.id is a numeric field, intval would do the trick.
Now, let's look at rewriting your query. It's very clunky to pull a pipe-delimited text string from the database only to explode it again. This is untested but this should work (if it doesn't post your db structure so I can try and recreate it and test the query myself):
SELECT s.uid, w.name as moviename, p.id, p.name as starring
FROM scenes s
LEFT JOIN people p ON s.personid = p.id
LEFT JOIN movies w ON s.movieid = w.id
WHERE p.id=1
GROUP BY s.movieid, s.sceneid
The number 1should be replaced by your escaped $_GET data.
Now we should be able to loop through the results and naturally create a multi-dimensional array:
$stars = array();
$result = @mysql_query($sql, $dbC);
while ($record = @mysql_fetch_array($result)) {
// split group_concat into managable chunks.
$stars[$record['starring']][] = $record[moviename];
}
mysql_close($dbC) or die("Error: ".mysql_error());
// sort array alphabetically
asort($stars);
foreach ($stars as $star=> $movies) {
echo($star.'<br />');
foreach ($movies as $moviename) {
echo($moviename.'<br />');
}
echo('<br />');
}