Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9036149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:55:01+00:00 2026-06-16T08:55:01+00:00

I am creating a csv file as given below $user_rep=Engine_Db_Table::getDefaultAdapter()->select() ->from(‘engine4_users’,array(‘user_id’,’email’,’displayname’)) ->query()->fetchAll(); $csv_output .=

  • 0

I am creating a csv file as given below

   $user_rep=Engine_Db_Table::getDefaultAdapter()->select()
                  ->from('engine4_users',array('user_id','email','displayname'))
                 ->query()->fetchAll();

   $csv_output .= "UserId Email Name"; 
    $csv_output .= "\n"; 

    foreach($user_rep as $key)
    {
        $csv_output .=$key['user_id']." ".$key['email']." ".$key['displayname'];
        $csv_output .= "\n"; 
    }


$filename = $file."_".date("d-m-Y_H-i",time()); // il nome del file sara' composto da quello scelto all'inizio e la data ed ora oggi

 header("Content-type: application/vnd.ms-excel");
 header("Content-disposition: csv" . date("Y-m-d") . ".csv");
 header( "Content-disposition: filename=".$filename.".csv");
 print $csv_output;
exit; 

I am getting the csv file. But I do have whitespace on my data for name. So I an getting o/p like

enter image description here

Actually, name is ‘test smart code’. I want this on a single column. How can we do that ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T08:55:02+00:00Added an answer on June 16, 2026 at 8:55 am

    You can use other separator for columns.
    Now you use space and then Excel separate all text by spaces.

    You you can include you text in quotes and then Excel can parse it as one field.

    For example try this:

    $csv_output .= "\"".$key['user_id']."\" \"".$key['email']."\" \"".$key['displayname']."\"";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a csv file from my vb.net application as shown below Dim
I'm creating some instances of the Item model shown below from a csv file.
I am creating a csv file from nested array and it works fine with
I am creating a CSV from a list of values. CSV File gets created
I'm successfully creating a CSV file from a query and saving the file on
I'm creating a csv file from a python script with this lines: def createFile():
So I am creating a dictionary with the values given in a csv file
I am creating a CSV file using BufferedWriter from a ResultSet object. A few
Using PHP to extract data from SQL and then creating a .csv file on
I'm creating a bash script to generate some output from a CSV file (I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.