From 09a601d58cfaf66dc4ea5cfe998aa676cad5d9e7 Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 5 May 2010 11:55:41 -0300 Subject: Initial test code for csv export --- tests/csv.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/csv.php (limited to 'tests/csv.php') diff --git a/tests/csv.php b/tests/csv.php new file mode 100644 index 0000000..2618cd0 --- /dev/null +++ b/tests/csv.php @@ -0,0 +1,35 @@ +db) { + // Prepare output + header("Content-type: application/text/x-csv"); + header("Content-Disposition: attachment; filename=export.csv"); + header("Pragma: no-cache"); + header("Expires: 0"); + + $rows = $isis->db->rows(); + $format = $isis->db->format; + + foreach ($format['fields'] as $field) { + echo $field['name'] .','; + } + + for ($n=1; $n <= $rows; $n++) { + $result = $isis->db->read($n); + // Format output. + foreach ($format['fields'] as $field) { + echo $result[$field['name']] .','; + } + echo "\n"; + } +} -- cgit v1.2.3