title: Using PHPExcel to make automatic generated excel files
body: <p>I want to have my excel file filled with some data which I get from my database, for example the name and age of someone.</p>
  
  <p>Say there are 10 people in my database. I want those 10 people in my Excel file. </p>
  
  <p>So basically, you would get: </p>
  
  <p>NAME   AGE</p>
  
  <p>Person1 20 years</p>
  
  <p>Person2 25 years</p>
  
  <p>And so on. I know how to set the NAME and AGE stuff, but how would I go about looping the data and writing it inside the excel file? I couldn't find anything about it in PHPExcel's documentation. </p>
  
  <p>This is my MySQL:</p>
  
  <pre><code>$query = "SELECT * FROM bestelling"; 
  
  $result = mysql_query($query) or die(mysql_error());
  
  while($row = mysql_fetch_array($result)){
      $name = $row['name'];
      $age = $row['age'];
  }
  </code></pre>