title: How To Use Zend Framework To Export To CSV Using mySQL's INTO OUTFILE Functionality
body: <p>I am looking to export a large amount of data into a CSV file for user download using Zend Framework. Is there any way to use Zend_Db's functionaity and use the "INTO OUTFILE" syntax to output the file as a csv? Basically I want to be able to adapt my Zend_Db models to export to a csv file instead of returning a PHP array. An example of the mysql syntax I want to use would be: </p>
  
  <pre><code>SELECT a,b,a+b INTO OUTFILE '/tmp/result.text' 
  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' 
  LINES TERMINATED BY '\n' 
  FROM test_table; 
  </code></pre>