diff options
author | Andrey Andreev <narf@bofh.bg> | 2013-03-01 15:27:35 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2013-03-01 15:27:35 +0100 |
commit | 6c463e162c37963312f51993b1ae5281b2643546 (patch) | |
tree | 284dc27d59ee5f752b9278b3fe954c1421833411 /system/database/DB_utility.php | |
parent | 8fcb019ee842718a1e03b5a85b20606072e07d8f (diff) | |
parent | 31875730b3cb67e865e99e748f885c5365339c9e (diff) |
Merge pull request #2290 from jonesmdj/develop
Remove trailing delimiters from csv_from_result
Diffstat (limited to 'system/database/DB_utility.php')
-rw-r--r-- | system/database/DB_utility.php | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index 9822fdaa3..b270cdd4d 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -238,7 +238,8 @@ abstract class CI_DB_utility { $out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $name).$enclosure.$delim; } - $out = rtrim($out).$newline; + $out = substr(rtrim($out), 0, -strlen($delim)); // Remove the trailing delimiter character(s) at the end of the column names + $out = $out.$newline; // Next blast through the result array and build out the rows while ($row = $query->unbuffered_row('array')) @@ -247,6 +248,7 @@ abstract class CI_DB_utility { { $out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure.$delim; } + $out = substr(rtrim($out), 0, -strlen($delim)); // Remove the trailing delimiter character(s) at the end of the row lines $out = rtrim($out).$newline; } |