title: PHP Mysql to create a Pipe delimeted output file
body: <p>I am using the below for csv export but i want to export as a pipe delimeted. </p>
  
  <pre><code>function to_CSV($table) {
  
      $file_csv = "file_csv.csv";
      $fp = fopen('php://output', 'w'); 
  
      $query = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='htmltable' AND TABLE_NAME='$table'";
      $result = mysqli_query(db_connect(),$query);
  
      while ($row = mysqli_fetch_row($result)) {
              $header[] = $row[0];
      }
  
      header('Content-type: application/csv');
      header('Content-Disposition: attachment; filename='.$file_csv);
      fputcsv($fp, $header);
  
      $query  ="SELECT * from $table";
      $result = mysqli_query(db_connect(),$query);
  
      while($row = mysqli_fetch_row($result)) {
              fputcsv($fp, $row);
      }
      exit;
  }
  </code></pre>
  
  <p>Help me out please</p>