Solved

phpadmin adding columns to csv files on import

Posted on 2014-12-02
9
94 Views
Last Modified: 2014-12-15
I have a site @hosting24.  The client wants it setup on dreamhosting.
I exported the tables from "hosting24" as csv files.  

I now have to use phpmyadmin to import the files.  When I do, I'm getting an error that there are duplicate column names.  It's adding two fields called "NULL" at the end of the header row.  I've looked at the "csv" files and they are correct.

Any ideas.

Thanks
Glenn
0
Comment
Question by:breeze351
  • 5
  • 2
  • 2
9 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
Create the table with the correct fields and then do the import.  If necessary, tell phpMyAdmin to skip the first row.  You also may need to tell phpMyAdmin which fields you are importing into.  It will take the data in order and put it into those fields in the table.  I do that to skip over 'id'/autoincrement fields.
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
two fields called "NULL" at the end of the header row
Just guessing but this may be due to line endings like CR/LF.  You may want to trim() the lines before using them in the import.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
I've never had a problem with phpMyAdmin and line endings.  I have uploaded 'standard' CSV files from Windows to phpMyAdmin on Linux fairly often over the past few years.  And on Windows too.  Never had to do anything about the line endings to make it work.
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
Might be helpful to see the data in the CSV files.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
I believe it would.
0
 

Author Comment

by:breeze351
Comment Utility
I exported the files from hosting as sql and then imported to dreamhosting and it did work.  I can import the csv files into Access, Excel and OpenOffice.  What is the diff between using "phpmyadmin" at dreamhost and "CPanel" at hosting24.  

I have no problems with "CPanel".  They are the same files.

I'm starting to think that it's the customers "consultant" wants us to fail.  He tells me to modify the php.ini but I don't have access to it.   Some of the files will not load because of the size limitations.  I have the same site and database on "hosting24"!

This is a "cluster f#ck"

I've attached a csv file that would not work.  I'm also attaching some screen prints of the problems with the uploads to "dreamhost".

Thanks
Glenn
mapfile.csv
Import-Errors.doc
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
Several of the errors are because PHP is running out of memory.  'mapfile.csv' is probably going to be one also.  Some of the others are probably bad definitions because NULL and DELETE are reserved words in MySQL and should not be used as column names.  I suspect if you check the tables that supposedly worked that the column names may not be correct.

I have always had to create the tables first for CSV uploads.  phpMyAdmin that I have used will not automatically do that.
0
 

Author Closing Comment

by:breeze351
Comment Utility
I'm not going to use Dreamhost.  They say that the will not help with PHP errors, and the customers consultant tells me that he does not know anything about PHP or databases!!  I set up a sub at hosting24 and haven't have any problems.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
Most web hosts will Not help with programming problems and errors.  Setting it up at hosting24 is probably a good choice.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now