<?php
 
/*
 
Example 1
 
*/
 
require("rs2csv.class.php");
 
$csv = new rs2csv; // create a new instance of the rs2csv class.
 
$csv->set_fname("example1.csv"); // Set the filename for download. Default is 'filename.csv'.
 
$csv->set_ctype("application/octet-stream"); // Set the content-type for download. Default is 'text/tab-separated-values'.
 
$csv->set_cdisp("attachment"); // Set the content-disposition for download. Default is 'attachment'.
 
$csv->set_sep(";"); // Set the seperator sign. Default is ','.
 
$csv->make_con("localhost", "root", "", "mysql"); // Open a database connection to the MySQL server.
 
$csv->exec_sql("SELECT * FROM user"); // Execute your SQL-query.
 
$csv->output_csv(); // Output the CSV file.
 
?>
 
 |