Why does my CSV output contain each column twice?

后端 未结 1 761
悲哀的现实
悲哀的现实 2020-12-07 06:44

I have the following:

$name = \'registrations.csv\';
header(\'Content-Type: text/csv\');
header(\'Content-Disposition: attachment; filename=\'. $name);
heade         


        
相关标签:
1条回答
  • 2020-12-07 06:57

    Change mysql_fetch_array() to mysql_fetch_assoc(). mysql_fetch_array() fetches both a numeric and associative array of the database results.

    while( $result = mysql_fetch_assoc$results) )
    {
      fputcsv($outstream, $result);
    }
    
    0 讨论(0)
提交回复
热议问题