Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
adding double quotes to csv
nikola_1988
February 2014
when i use
$output = Format::forge()->to_csv($data, ', ');
it adds additional quotes...is there a trick or something to do with the format of $data being converted to csv...please help!
Harro
February 2014
What do you mean with "additional quotes"?
nikola_1988
February 2014
https://imagizer.imageshack.us/v2/428x210q90/543/67gs.png
there should be only 1 quotes on each side right?
Harro
February 2014
What is the input array? Any quotes in there? And what is your format config? And which version of Fuel?
nikola_1988
February 2014
input array is \DB::select()->execute->as_array(),format config is default,fuel is 1.6
Harro
February 2014
Accepted Answer
Works fine here, must be at your end somewhere. Just ran this in 1.6:
$result = \DB::select()->from('groups')->execute()->as_array();
var_dump($result);
$result = \Format::forge()->to_csv($result, ',');
var_dump($result);
Results:
array (size=2)
0 =>
array (size=2)
'id' => string '1' (length=1)
'name' => string 'Group 1' (length=7)
1 =>
array (size=2)
'id' => string '2' (length=1)
'name' => string 'Group 2' (length=7)
string '"id","name"
"1","Group 1"
"2","Group 2"' (length=39)
nikola_1988
February 2014
ok thank you
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,089
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
261
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
February 2014
nikola_1988
February 2014