Login   Register  
PHP Classes
elePHPant
Icontem

File: example_csv.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ellery Leung  >  Create CSV  >  example_csv.php  >  Download  
File: example_csv.php
Role: Example script
Content type: text/plain
Description: Example
Class: Create CSV
Generate CSV files from MySQL query results
Author: By
Last change: Show new usage of quoting the CSV value.
Date: 2007-06-30 01:57
Size: 689 bytes
 

Contents

Class file image Download
<?php
include("CreateCSV.class.php");
$conn mysql_connect("localhost""root""");

$sql "SELECT * FROM mysql.user";

#Thanks for nlstart's suggestions, now this class support quoted for CSV value.

//To print out the record without column heading and all values are quoted
print CreateCSV::create($sql);

//To print out the record without column heading and all values are NOT quoted
print CreateCSV::create($sqlfalsefalse);

//To print out the record with column heading and all values are quoted
print CreateCSV::create($sqltrue);

//To print out the record with column heading and all values are NOT quoted
print CreateCSV::create($sqltruefalse);

?>