diff options
author | admin <devnull@localhost> | 2006-09-26 20:14:43 +0200 |
---|---|---|
committer | admin <devnull@localhost> | 2006-09-26 20:14:43 +0200 |
commit | b63ac845de0c7c57c7db755de9af36ce34b67426 (patch) | |
tree | b852d227ad6bda19d1c5bf3166a3638a895eb8d7 | |
parent | 6e00bab0ecfbbdd35d135a297d54a4989a44e500 (diff) |
-rw-r--r-- | system/database/DB_export.php | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/system/database/DB_export.php b/system/database/DB_export.php index 14e7af68b..02b4b42ad 100644 --- a/system/database/DB_export.php +++ b/system/database/DB_export.php @@ -12,7 +12,6 @@ * @since Version 1.0 * @filesource */ - // INITIALIZE THE CLASS --------------------------------------------------- @@ -38,10 +37,13 @@ class CI_DB_export { } /** - * Generate CVS + * Generate CVS from a query result object * * @access public - * @return integer + * @param object The query result object + * @param string The delimiter - tab by default + * @param string The newline character - \n by default + * @return string */ function generate_cvs($query, $delim = "\t", $newline = "\n") { @@ -51,13 +53,15 @@ class CI_DB_export { } $out = ''; + + // First generate the headings from the table column names foreach ($query->field_names() as $name) { $out .= $name.$delim; } - $out .= $newline; + // Next blast through the result array and build out the rows foreach ($query->result_array() as $row) { foreach ($row as $item) @@ -67,7 +71,6 @@ class CI_DB_export { $out .= $newline; } - return $out; } |