Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $file = fopen('demosaved.csv', 'w');
- // save the column headers
- fputcsv($file, array('Column 1', 'Column 2', 'Column 3', 'Column 4', 'Column 5'));
- // Sample data. This can be fetched from mysql too
- $data = array(
- array(01523, 'Data 12', 'Data 13', 'Data 14', 'Data 15')
- );
- // save each row of the data
- foreach ($data as $row)
- {
- fputcsv($file, $row);
- }
- // Close the file
- fclose($file);
Add Comment
Please, Sign In to add comment