Welcome Guest, Not a member yet? Register   Sign In
Different column for csv_from_result function in written file?
#1

[eluser]jpganz[/eluser]
Hi,

I am using csv_from_result to export my result to a cvs file, still I am having a problem with it, I wanna export the results separated each column on my cvs per field returned from my DB,

I checked this post http://ellislab.com/forums/viewthread/214852/ and I tried the /t, but still no results, any other has this problem? I am using CI 2.1

here is my code

Code:
$this->load->dbutil();
$this->db->select('profile.profile_username,..... other fields');
$this->db->from('profile');
$this->db->join('client', 'client.id_profile = profile.id_profile', 'left');
$query = $this->db->get();
$enclosure = '';
$delimiter = "/t";
$newline = "\r\n";
$queryreturn = $this->dbutil->csv_from_result($query,$delimiter,$newline,$enclosure);

Any help would be appreciated.
Thanks
#2

[eluser]CroNiX[/eluser]
I believe that should be a forward slash. \t is tab, not /t. Just like \r\n is linebreak/return.
#3

[eluser]jpganz[/eluser]
Thanks, I tried with "\t" too, but didnt work...
#4

[eluser]CroNiX[/eluser]
What is it doing then? What's the output?
#5

[eluser]jpganz[/eluser]
with “\t” nothing happends, like if it wouldnt exist.. not even an space, if is "/t" the /t is printed in the doc.
#6

[eluser]CroNiX[/eluser]
What happens if you just use the default values, which would be a comma for the delimiter?

Code:
$queryreturn = $this->dbutil->csv_from_result($query);
#7

[eluser]jpganz[/eluser]
with the comma it only shows the comma... it prints it (the comma was the first value I tried but didnt work)




Theme © iAndrew 2016 - Forum software by © MyBB