$rs = mysql_query("select data1_id, answer, count from tbl_name where data1_id>=7 and data1_id<=12 order by data1_id");
$num = 0;
while($row = mysql_fetch_array($rs)) {
  $out[$row['data1_id']][$row['answer']] = $row['count'];
  $num += $row['count'];
  if(count($out[$row['data1_id']]) == 3) {
    echo $row['data1_id'];
    foreach($out[$row['data1_id']] as $key=>$value)
      echo " ".round($value*100/$num,2)."%";
    echo "<br>";
    $num = 0;
  }
}