热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

phpmyadmin导出到excel的csv-phpmyadminexportingtocsvforexcel

Imhavingproblemusingxampp(4.1.6)phpmyadminexportfunction.WhenIexport,Iselectcsvfore

I'm having problem using xampp (4.1.6) phpmyadmin export function. When I export, I select csv for excel format, but it will return the data like:

我在使用xampp (4.1.6) phpmyadmin导出功能时遇到了问题。当我导出时,我选择了excel格式的csv,但是它会返回如下数据:

1;"data1";"0";"6828";"2014-03-13 13:54:26";"2014-03-13 13:54:26";"file";;"2014-03-14 14:45:51"

So I tried the syntax:

所以我尝试了语法:

SELECT * FROM `directory_listing` 
INTO OUTFILE 'C:/test.csv' 
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"' 
LINES TERMINATED BY '\n'

Now the format is the same as the table view as in mysql table. Problem is, I want to display the column name on 1st row. How can i do that?

现在的格式与mysql表中的表视图相同。问题是,我想在第一行显示列名。我怎么做呢?

By the way, below is the interface of my phpmyadmin export function.

顺便说一下,下面是我的phpmyadmin导出函数的接口。

phpmyadmin export tab

I tried to export it as normal csv, but it still return the same. even worse, ALL the data is put inside 1st row.

我尝试将它导出为普通的csv,但它仍然返回相同的值。更糟糕的是,所有的数据都放在第一排。

phpmyadmin export for normal csv

2 个解决方案

#1


4  

You almost got it right, you just have to check the "Put colums names in first row" checkbox and then start the export. That should do the job.

您几乎是对的,您只需检查“在第一行中放入列名”复选框,然后启动导出。这应该是可行的。

EDIT::

编辑::

Since your doin it your self you can get the fieldnames with this MYSQL query:

既然你自己做了,你可以通过这个MYSQL查询获得字段名:

    SELECT `COLUMN_NAME` 
FROM `INFORMATION_SCHEMA`.`COLUMNS` 
WHERE `TABLE_SCHEMA`='yourdatabasename' 
    AND `TABLE_NAME`='yourtablename';

#2


0  

Just check the Put columns names in the first row checkbox above the Go button.

只需在Go按钮上方的第一行复选框中选中Put列名称。


推荐阅读
author-avatar
小马哥
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有