Takes an array and creates a csv string from it.
String
arrayToCsvString
(Array $array, [String $separator = ';'], [String $trim = 'both'], [Boolean $removeEmptyLines = TRUE])
-
Array
$array: (see below)
-
String
$separator: Field separator ()default is ';')
-
String
$trim: If the cells should be trimmed , default is 'both'. It can also be 'left', 'right' or 'both'. 'none' makes it faster since omits many function calls.
-
Boolean
$removeEmptyLines: (default is TRUE. removes "lines" that have no value, would come out empty.)
Generate the CSV File and send it to browser or download it as a file
void
dump
(String $query_string, [String $filename = "dump"], [mixed $ext = "csv"], [String $dbname = "mysql"], [String $user = "root"], [String $password = ""], [String $host = "localhost"], String $extension)
-
String
$query_string: An SQL statement (usually a SELECT statement)
-
String
$filename: Filename to use when downloading the File. Default="dump". If set to "", the dump is displayed on the browser.
-
String
$extension: Extension to use when downloading the File. Default="csv"
-
String
$dbname: Name of the Database to use
-
String
$user: User to Access the Database
-
String
$password: Password to Access the Database
-
String
$host: Name of the Host holding the DB
Generates a CSV File from an SQL String (and outputs it to the browser)
void
_db_connect
([String $dbname = "mysql"], [String $user = "root"], [String $password = ""], [String $host = "localhost"])
-
String
$dbname: Name of the Database
-
String
$user: User to Access the Database
-
String
$password: Password to Access the Database
-
String
$host: Name of the Host holding the DB
Define EOL character according to target OS
String
_define_newline
()
Generates a CSV File from an SQL String (and outputs it to the browser)
void
_generate_csv
(String $query_string, [String $dbname = "mysql"], [String $user = "root"], [String $password = ""], [String $host = "localhost"])
-
String
$query_string: An SQL statement (usually a SELECT statement)
-
String
$dbname: Name of the Database
-
String
$user: User to Access the Database
-
String
$password: Password to Access the Database
-
String
$host: Name of the Host holding the DB
Define the client's browser type
String
_get_browser_type
()
Define MIME-TYPE according to target Browser
String
_get_mime_type
()
Works on a string to include in a csv string.
String
_valToCsvHelper
(String $val, String $separator, Mixed $trimFunction)
-
String
$val
-
String
$separator
-
Mixed
$trimFunction: If the cells should be trimmed , default is 'both'. It can also be 'left', 'right' or 'both'. 'none' makes it faster since omits many function calls.