February 08, 2012, 11:10:55 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
: Welcome to the new trading eye refugees
Home
Help
Search
Login
Register
DotDragnet
>
The Tech Side
>
Tech stuff
>
CSV import to MySQL via phpMyAdmin
Pages: [
1
]
Go Down
« previous
next »
Print
Author
Topic: CSV import to MySQL via phpMyAdmin (Read 1270 times)
orydian
Hero Member
Posts: 1230
CSV import to MySQL via phpMyAdmin
«
on:
February 17, 2010, 05:20:04 PM »
Okay, this is driving me round the bend. I'm trying to import a single column/field into MySQL.
CSV looks like this...
"Name A",
"Name B",
"Name C",
and so on.
I'm trying to import it into a table with a field called 'name'.
I locate the correct table via phpMyAdmin and click to import the file with the following settings...
Fields terminated by = ,
Fields enclosed by = "
Fields escaped by = \
Lines terminated by = auto
Column names = name
Then I click Go, but I always get a "Invalid field count in CSV input on line 1." error.
I'm very knew at this, and I'm clearly doing something wrong, but I've no idea what the problem is. If anyone could help with this, I'd really appreciate it.
ory.
Logged
ory like lorry, not ory like story -
twitter
|
tumblr
sarahA
DDN Contribs
Hero Member
Posts: 2123
Re: CSV import to MySQL via phpMyAdmin
«
Reply #1 on:
February 17, 2010, 07:56:29 PM »
Set lines terminated by as /n/r and open the file you're importing and check there are no extra columns (ie. there's not any commas if you only have one column), and that there are no blank lines
Logged
Stuff By Me
:
Photos
JasonD
Global Moderator
Hero Member
Posts: 529
Re: CSV import to MySQL via phpMyAdmin
«
Reply #2 on:
February 17, 2010, 08:00:23 PM »
You have a comma at the end of the line so it will want to insert an empty value into a second column.
Remove the commas from the file, or add a column to fill with the nothing and remove it when you are done.
Logged
orydian
Hero Member
Posts: 1230
Re: CSV import to MySQL via phpMyAdmin
«
Reply #3 on:
February 17, 2010, 08:23:23 PM »
Cheers guys. I'll try it out.
ory.
Logged
ory like lorry, not ory like story -
twitter
|
tumblr
orydian
Hero Member
Posts: 1230
Re: CSV import to MySQL via phpMyAdmin
«
Reply #4 on:
February 17, 2010, 08:30:54 PM »
Yes! Removing the commas did the trick.
Thank you both very much indeed.
ory.
Logged
ory like lorry, not ory like story -
twitter
|
tumblr
Pages: [
1
]
Go Up
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> General Discussion
=> Jee's Forum of Appalling Jokes
-----------------------------
The Creative Side
-----------------------------
=> Arty stuff
=> Photography
=> On the web
-----------------------------
The Tech Side
-----------------------------
=> Tech stuff
=> Hardware & Software
-----------------------------
The Business Side
-----------------------------
=> Anything business related
-----------------------------
The Practical Side
-----------------------------
=> Practical Advice
DotDragnet
>
The Tech Side
>
Tech stuff
>
CSV import to MySQL via phpMyAdmin
Loading...