Export a mysql table into CSV using PHP code

前端 未结 4 1249
猫巷女王i
猫巷女王i 2021-01-20 22:56

I have a my sql table called pvdata, I would like to export it to csv file.

But I\'m obtaining the following results instead of the normal looking table:



        
4条回答
  •  無奈伤痛
    2021-01-20 23:19

    I don't know if it is a typo, but within your script are spaces before the

       

    this will result in an html document being delivered and your header-calls will fail. So remove the spaces and any other output before "header" calls.

    You are getting error messages up there, for a quick solution try:

    error_reporting(0);
    

    Line 28: $header is not known, this makes

    $header .=
    

    appending to a unknown variable.

提交回复
热议问题