title: putcsv formatting wrong when result is from pdo
body: <p>I am trying to import data from a db via pdo and output the results to a csv file. I am able to output to a screen correctly but the formatting in the csv is wild, double names and no '\n'  </p>
  
  <pre><code>&lt;?php
  require_once('auth.php');
  $conn = new PDO("mysql:host=localhost;dbname=$dbname", $username, $pw);
  
  if (($handle = fopen("nameList2.txt", "r")) !== FALSE) {
          while (($data = fgetcsv($handle, 1000, "        ")) !== FALSE) {
                  $firstname = $data[0];
                  $lastname = $data[1];
                  $stmt = $conn-&gt;prepare("SELECT * FROM list WHERE FName = :firstname AND LName = :lastname");
                  $stmt-&gt;bindParam(':firstname', $firstname);
                  $stmt-&gt;bindParam(':lastname', $lastname);
                  $stmt-&gt;execute();
                  $result = $stmt-&gt;fetchAll();
                  //var_dump($firstname);
                  //var_dump($lastname);
                  //var_dump($result);
                  $fp = fopen('file.csv', 'w');
                  foreach($result as $chunk){
                          echo $chunk[4]."        ".$chunk[6]."   ".$chunk[7]."   ".$chunk[10]."  ".$chunk[11]."".$chunk[12]."  ".$chunk[13]."  ".$chunk[18]."  ".$chunk[19]."  ".$chunk[20]."&lt;br /&gt;";
                          fputcsv($fp, $chunk);
                  }
                  fclose($fp);
          }
          fclose($handle);
          //fclose($fp);
  }
  
  ?&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/6v80n.png" alt="enter image description here"></p>