write in to csv #csv
 Edit
 by ramesh - 10 years ago (2015-03-01)
get data from db and put  in csv
 | get data from db and put  in csv  | 
- 1 Clarification request
 1. 
 by Manuel Lemos - 10 years ago (2015-03-04) Reply
What database are you using? Is it MySQL or some other database?
Ask clarification
1 Recommendation
MySQL Database Library: Access MySQL databases and manipulate files
This class can access MySQL databases and execute common queries. Currently it can:
- Connect to a given MySQL host and access a given database
- List all tables in the accessible databases
- Get the columns of a given table
- Compose and execute SELECT queries to a given table getting specific fields by a given sorting order returning the results into a single array
- Search for given table records that match given conditions
- Insert table records with given field values
- Update table records with given field values and conditions
- Delete table records that match a condition
- Create table records for a new user with a password
- Authenticate a given user with a password in the users table
- Change a given user password in the users table
- Update or delete given user records in the users table
- Read the text contents of files in the format CSV, PDF or Microsoft Word
- Write plain text or CSV files
- Rename or delete files
- Get the list of files from a directory
- Etc..
 |   by Justin Eldracher   package author   160 - 10 years ago (2015-06-22) Comment
 My MySQL database class has a write() method that outputs a matrix to csv.  (All the SELECT statements in my class return a matrix.)
So you could use it like so: 
include "DB.php";
$db = new DB("my_table");
$db->write("output_file_name.csv", $db->all()); 
Including a third parameter will let you save in tab or any other form of delimited format.  |