答案 0 :(得分:1)
为什么你在PHP方面做这个呢?
SELECT * INTO OUTFILE "c:/mydata.csv"
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY "\n"
FROM my_table;
答案 1 :(得分:0)
$output = array($row->fornamn . " " . $row->efternamn . " " . $row->personnr . " " . $row->gatuadress . " " . $row->postnr . " " . $row->postadress, ''
应替换为
$output = array($row->fornamn, $row->efternamn, $row->personnr, $row->gatuadress, $row->postnr, $row->postadress)
答案 2 :(得分:0)
$fp = fopen("filename.csv","w");
$value = array($var1,$var2,$var3);
fputcsv($fp,$value,"\t");