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 6694257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:04:50+00:00 2026-05-26T06:04:50+00:00

I inherited a site and need some help. There is a fwrite() function in

  • 0

I inherited a site and need some help. There is a fwrite() function in php that writes a csv file using information from a database. One of the things I want to be written is a product description. The descriptions all have commas, and when the csv sees the commas, it starts a new cell breaking the description up into many different cells. I would prefer if the entire description was in one cell. I can get it to do that if I str_replace() the commas to something else, so that part of the code isn’t the issue.

What’s the best way (if it’s even possible) to write a value that contains commas to a csv file?

Right now, it looks something like this:

$orderrecord = '"'.$row['product_description_that_has_commas'].'"';

        $orderrecord .= "\r\n";
        $ofl = fopen($exportordersfilename, 'ab');
        fwrite($ofl, $orderrecord);
        fclose($ofl);
  • 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-05-26T06:04:51+00:00Added an answer on May 26, 2026 at 6:04 am

    Look at the PHP function called fputcsv().

    <?php
    
    $fh = fopen('file', 'w');
    fputcsv($fh, array($description_with_quotes, 'field_two', '...'));
    fclose($fh);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have inherited a legacy classic asp site that I need to support, and
I have inherited a web site project that makes use of a number of
A friend of mine has inherited an old Joomla 1.0.x site, that amongst other
I need advice. I inherited a website that's been around a long time. The
I inherited a Drupal5 site and have been tasked with making some changes, but
I have inherited some legacy PHP code what was written back when it was
So, I need to make changes to an asp.net built site that was recently
Okay, I am stumped on this one and need some quick help. I have
I've inherited an ASP.NET web site that has an SSL certificate bought via GoDaddy.
I inherited some code that was recently attacked by repeated remote form submissions. Initially

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.