Förutsatt att allt du försöker göra är att återskapa dessa rader i en rullgardinsmeny:
$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>";