title: storing percentages into an array
body: <p>I'm trying to store a number of percentages that I've worked out into an array so that I can call it later on to create a pie chart but don't have a clue how to do it. Here is my PHP code so far for working out the percentages:           Thanks for any help in advance!</p>
  
  <pre><code>//execute the SQL query and return records
  $result = mysql_query("SELECT book_id, COUNT(*) FROM loan GROUP BY book_id ASC ORDER BY     count(*) DESC LIMIT 10");
  $book_count = mysql_num_rows($result);
  
  $step = 1;
  
  while($row = mysql_fetch_array($result))
  {
      $total = $total + $row['COUNT(*)'];
      $i[$step] = $row['COUNT(*)'];
      $step++;
  }
  
  for($index = 1; $index &lt;= 10; $index++)
  {
      $percentage[$index] = (($i[$index]/$total)*100);
      #$degrees = (($percentage/100)*360);
  }
  </code></pre>