title: Export PHP Variable Results To CSV
body: <p>I am using php to run a SQL Query and populate a HTML Table.  My question is, since I have the $query variable house the sql results, would it be possible to add a button to "Export To CSV" and if the button is clicked it will export a .csv file of the $query that is formatted the same way that the html table that is generated?</p>
  
  <p>Say the query string is like this:</p>
  
  <pre><code>$query .= "Select red, green, blue from colorsDB where signoff is not null";
  $db-&gt;setQuery($query);
  $query = $db-&gt;loadObjectList();
  </code></pre>