Like what I said above I started with a empty table and I started to
import data from a *.csv in phpmyadmin and I had immediately the error
so the import didn't work...
If I don't recall it wrong, phpmyadmin uses transactions when using
innodb tables, so if you have an error while importing, it will rollback
the transaction and those the table will be empty when you look at it.
I do suggest you take a look at your csv file and I'm quite sure you
will find two entries with the recipe_id=5 and subfoodgroup_id=413.
Suggest you load it in LibreOffice, sort it first on the recipe_id
column and then the subfoodgroup_id column and you will easilly find
your duplicates.
I don't know why I have a lot of ,,,,, I happened just with this file, I
just tried with:
If I don't recall it wrong, phpmyadmin uses transactions when using
innodb tables, so if you have an error while importing, it will
rollback the transaction and those the table will be empty when you
look at it.
If I force the error I can upload a single record but it doesn't work on *.csv import... :\
I do suggest you take a look at your csv file and I'm quite sure you
will find two entries with the recipe_id=5 and subfoodgroup_id=413.
Suggest you load it in LibreOffice, sort it first on the recipe_id
column and then the subfoodgroup_id column and you will easilly find
your duplicates.
My *.csv file:
,,,,,,,,,,,,,,,,,,1,52,Show
,,,,,,,,,,,,,,,,,,1,54,Show
,,,,,,,,,,,,,,,,,,1,35,Show
,,,,,,,,,,,,,,,,,,1,37,Hide
,,,,,,,,,,,,,,,,,,1,39,Hide
,,,,,,,,,,,,,,,,,,1,34,Show
I don't know why I have a lot of ,,,,, I happened just with this file, I
just tried with:
1,52,Show
1,54,Show
1,35,Show
1,37,Hide
1,39,Hide
1,34,Show
It works (I tried it on import area of phpmyadmin), maybe there's
something wrong on my *.ods file or when I save it as *.csv.
sed 's/,*\([0-9].*\)/\1/' -i faultyfile.csv
this will remove the leading ,
if you want to remove the duplicates you can run
sort -u faultyfile.csv > noduplicates.csv
of course this is how you do it in the worlds most used OS or an Unix,
if you happen to have that Redmond based company's OS, then you need to install a lot of extra stuff.
Then you solved your issue.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 20:51:07 |
Calls: | 6,646 |
Calls today: | 1 |
Files: | 12,190 |
Messages: | 5,327,412 |