title: fputcsv - only one column
body: <p>I want to save parts (and differently arranged) of my mysql database in a CSV file. For that I  wrote this piece of code:</p>
  
  <pre><code>$headerDisplayed = false;
  foreach ($arr as &amp;$currName)
  {
      $result2 = mysql_query("SELECT * FROM Experiment Where Person='$currName'"); 
      $i = 1;
      while ($row2 = mysql_fetch_array($result2)) 
      {
          $list['Name'] = $currName;
          $list['Studie'] = $row2['Studie']; 
          if(strcmp($row2['Antwort'],$row2['Korrekt']) == 0)
          {
              $list["A $i"] = '0';
          }
          else
          {
              $list["A $i"] = '1';
          }
  
          $i++;
      }
  
      if ( !$headerDisplayed ) {
          // Use the keys from $data as the titles
          fputcsv($fp, array_keys($list));
          $headerDisplayed = true;
      }
  
      fputcsv($fp, $list);
  }
  
  fclose($fp);
  </code></pre>
  
  <p>Unfortunately this does not what I wanted it to do. My plan was that each entry of <code>$list</code> (e.g. <code>$list["A 1"]</code> or <code>$list["A 15"]</code>) has its own column. And then the call of <code>fputcsv</code> should create a new line and again one column for each <code>$list</code> entry.
  I create new rows with each <code>fputcsv</code> call, just as expected, but the complete <code>$list</code> array is in the first (most left) column.</p>
  
  <p>What do I have to do to solve this issue?</p>
  
  <p><strong>ADDED:</strong>
  I get something like:</p>
  
  <pre><code>[1,0,0,0,1,1,0,0] [] [] [] [] [] [] []
  
  [1,0,1,1,0,1,0,0] [] [] [] [] [] [] []
  
  [0,1,1,1,1,1,0,1] [] [] [] [] [] [] []
  </code></pre>
  
  <p>but what I want is more like:</p>
  
  <pre><code>[1] [0] [0] [0] [1] [1] [0] [0]
  
  [1] [0] [1] [1] [0] [1] [0] [0]
  
  [0] [1] [1] [1] [1] [1] [0] [1]
  </code></pre>