第1行CSV输入中的字段计数无效 [英] Invalid field count in CSV input on line 1

查看:1909
本文介绍了第1行CSV输入中的字段计数无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将ODS文件导出为CSV,但当我导入到phpmyadmin中时,我得到第1行CSV输入中的字段计数无效。



文件(它有两行以上但方案是一样的):

 code>管理国家共和国
管理公共电子市场



< h3>表:

  CREATE TABLE如果不存在`profession`(
`id_profession` int ,
`profession` varchar(45)DEFAULT NULL,
`formation_area_id_formation_area` int(11)NOT NULL,
PRIMARY KEY(`id_profession`),
UNIQUE KEY`profession_UNIQUE` (`profession`),
KEY`fk_profession_formation_area1`(`formation_area_id_formation_area`)
)ENGINE = InnoDB DEFAULT CHARSET = utf8;

我从来不做类似的事情,可能我需要指定列。 csv只有一列,而表有三列。在这种情况下,文件输入属于职业列

解决方案

如果要将其导入该表,您有两个选择: / p>

1)在文件每行中的数据前后添加逗号,或



2)删除您表格中的第一列和第三列,导入数据,然后添加您删除的2列。


I am trying to export an ODS file to CSV, but when I import into phpmyadmin - I get "Invalid field count in CSV input on line 1."

File (it has more than two lines but the scheme is the same):

"Administração da Guarda Nacional Republicana"
"Administração de Publicidade e Marketing"

table:

CREATE TABLE IF NOT EXISTS `profession` (
  `id_profession` int(11) NOT NULL,
  `profession` varchar(45) DEFAULT NULL,
  `formation_area_id_formation_area` int(11) NOT NULL,
  PRIMARY KEY (`id_profession`),
  UNIQUE KEY `profession_UNIQUE` (`profession`),
  KEY `fk_profession_formation_area1` (`formation_area_id_formation_area`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

I never do something similar, probably i need to specify the columns. the csv only have one column and the table have three. In this case the file input belongs to profession column

解决方案

If you want this to import into that table you have 2 choices:

1) Add a comma before and after the data in every row of your file, or

2) Delete the first and third columns in your table, import the data and then add the 2 columns you deleted back.

这篇关于第1行CSV输入中的字段计数无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆