How to open .csv files?

How to import CSV files into Mysql through a website?

  • I'm creating a website using PHP and I need to create a part where the database is actualized through a CSV (Comma Separated Values) file. I was already able to do this using the LOAD DATA LOCAL INFILE 'filename.csv' INTO TABLE Tablename, but I am not sure how I can implement it on the website so the admin can do it from any computer with the CSV file. Probably isn't important, but I am using a bundle called WAMP Server, which has Apache, PHP and MySQL. Any help would be greatly appreciated.

  • Answer:

    Your set-up with apache is fine. - Use a file-upload system to upload your CSV file to the server (with input type=FILE). - Once on the server, use the Php built-in functions to insert inyour table (check www.php.net, -> CSV) There are several functions and samples to help you achieve what you want. The only problem is that the CSVfile MUST have exactly the same record length as the table field list, otherwise, you get errors you will have to handle separately.

Ironmagi... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.