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
Related Q & A:
- How to merge multiple CSV files into a single CSV file?Best solution by solveyourtech.com
- How to add links on the fly in a website?Best solution by Yahoo! Answers
- How much do you charge for advertising on a website?Best solution by Yahoo! Answers
- How do plugins identify what type of server a website is running on?Best solution by Stack Overflow
- How much do you get paid for making a website?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.