title: how to escape the delimiter from the column content when export csv
body: <p>Im up to export the CSV file, delimiter is a "," comma but im there is a problem if column content had comma , it will break the csv out put when looking on libre office calc.</p>
  
  <p>if any body can help me how to solve this</p>
  
  <p>here im upto now</p>
  
  <pre><code>//$filename = $row['fileName'].'-ConsignmentInfo.csv';
  $filename="test.csv";
  $delim = ',';
  $columns = array('0Product_Number', 'Product_Name', 'Alternative_Title');
  echo implode($delim,$columns )."\n";           
  
  $ptr1 = DD_Db::fetch("SELECT p.pNum,p.pName,a.varcharValue FROM ds_products p   left join productAttribute a on a.id=p.pID where a.attributeId= (select id FROM attribute where attributeName='alternateTitle') ");
  
   foreach ($ptr1 as $row) {
        $line = array("\"{$row['pNum']}\"","\"{$row['pName']}\"","\"{$row['varcharValue']}\"");
        echo implode($delim,$line)."\n";
   }
  
  header('Content-Type: text/csv');
  header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
  header('Content-Disposition: attachment; filename='.$filename);
  header('Pragma: cache');
  header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  exit;
  </code></pre>