aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-05-05 14:50:08 -0300
committerSilvio <silvio@devlet.com.br>2010-05-05 14:50:08 -0300
commit55652f80494658bf685c2101c6be2abd793592d6 (patch)
tree64c968f4433a00a160ca6187acbc47beaa3c6fe2
parent858b0424c630bc1b4da42d7ab9b8fdbe05d50b62 (diff)
downloadcinisis-55652f80494658bf685c2101c6be2abd793592d6.tar.gz
cinisis-55652f80494658bf685c2101c6be2abd793592d6.tar.bz2
CSV export enhancements (2)
-rw-r--r--tests/csv.php16
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";
}
}