diff options
author | Silvio <silvio@devlet.com.br> | 2010-05-05 14:50:08 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-05-05 14:50:08 -0300 |
commit | 55652f80494658bf685c2101c6be2abd793592d6 (patch) | |
tree | 64c968f4433a00a160ca6187acbc47beaa3c6fe2 /tests/csv.php | |
parent | 858b0424c630bc1b4da42d7ab9b8fdbe05d50b62 (diff) | |
download | cinisis-55652f80494658bf685c2101c6be2abd793592d6.tar.gz cinisis-55652f80494658bf685c2101c6be2abd793592d6.tar.bz2 |
CSV export enhancements (2)
Diffstat (limited to 'tests/csv.php')
-rw-r--r-- | tests/csv.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/csv.php b/tests/csv.php index 2787575..070ee2f 100644 --- a/tests/csv.php +++ b/tests/csv.php @@ -6,7 +6,7 @@ /** * Format a value for CSV output. */ -function csv($field) { +function csv($field = NULL) { return '"'. preg_replace('/"/', '""', $field) .'",'; } @@ -38,17 +38,27 @@ if ($isis->db) { } } + // New roll. + echo "\n"; + // Format output. - for ($n=1; $n <= $rows; $n++) { + for ($n=1; $n <= $n; $n++) { $result = $isis->db->read($n); foreach ($format['fields'] as $field) { - echo csv($result[$field['name']]); + if (is_array($result[$field['name']])) { + echo csv(); + } + else { + echo csv($result[$field['name']]); + } if (is_array($field['subfields'])) { foreach ($field['subfields'] as $key => $value) { echo csv($result[$field['name']][$value]); } } } + + // New roll. echo "\n"; } } |