1csv 2=== 3 4This method exports your results in CSV 5(`Comma Separated Values <http://en.wikipedia.org/wiki/Comma-separated_values>`_). 6 7 8Parameters 9.......... 10 11:: 12 13 csv($sql) 14 15:$sql: Your normal sql or either a prepared statement query. 16 17:returns: CVS. 18 19Example 20....... 21 22Serve a CSV file: 23 24.. code-block:: php 25 :linenos: 26 :emphasize-lines: 17 27 28 <?php 29 30 header("Content-type: application/csv"); 31 header("Content-Disposition: attachment; filename=$filename.csv"); 32 header("Pragma: no-cache"); 33 header("Expires: 0"); 34 35 require_once 'dalmp.php'; 36 37 $user = getenv('MYSQL_USER') ?: 'root'; 38 $password = getenv('MYSQL_PASS') ?: ''; 39 40 $DSN = "utf8://$user:$password".'@127.0.0.1/test'; 41 42 $db = new DALMP\Database($DSN); 43 44 $db->csv('SELECT row1, row2, row3, row4 FROM table WHERE uid=? AND cat=?', 3, 'oi');