Ervan uitgaande dat u alleen deze rijen probeert te echoën in een vervolgkeuzelijst:
$sql = "SELECT quali_code, title FROM `qualifications` ORDER BY title ";
$result = mysql_query($sql, $this->connection);
while($r=mysql_fetch_array($result))
{
$quali_code = $r['quali_code'];
$result_array[$quali_code][] = $r['title'];
}
echo "<select name='x'>";
foreach($result_array as $q_code => $value)
{
foreach($value as $title) {
echo "<option value='" . $q_code . "'>" . $title . "</option>";
}
}
echo "</select>";