Sono irrimediabilmenti un anima semplice. Caricherei tutto su un array...

Codice PHP:

$array 
= array(1999 => 02000 => 02001 => 0
               
2002 => 02003 => 02004 => 0
               
2005 => 02006 => 02007 => 0);
                        
$query "select year(data) as anno, sum(valori) as tot
          from voti
          group by anno
          order by anno"
;

$res mysql_query($query);

while(
$row mysql_fetch_assoc($res) ) {
 
   
$array[$row['anno']] = $row['tot'];
 
}
 
 
print_r($array);