Prova con:
Codice PHP:
<?php
// Codice
$sql = "SELECT * FROM tabella ORDER BY argomento ASC, sottoargomento ASC";
$res = mysql_query($sql);
$output = array();
while ( $line = mysql_fetch_object($res) ) {
$output[$line->argomento][] = array(
'id' => $line->id,
'valore' => $line->valore,
'sottoargomento' => $line->sottoargomento
);
}
?>
<?php foreach ( $output as $argomento => $dati ): ?>
<ul>[*]
<?php echo $argomento; ?>
<ul>
<?php foreach ( $dati as $oggetto ): ?>[*]<?php echo $oggetto['sottoargomento']; ?>
<?php endforeach; ?>[/list]
[/list]
<?php endforeach; ?>