Import CSV file into a MySQL database

Submitted by: 
Visitors have accessed this post 872 times.

Sometimes we might want to migrate our csv file/xlsx-file(s) into our database in order to work with them accordingly, php makes that possible.
With regards to this, I have written a simple script to make that easier base on a request from a good friend of mine and I thought it wise to share it with the world.
1. Firstly unzip the project file and paste it in your htdocs if you're using xampp or www folder if you are using wamp or your server folder if any.
2. Locate a readMe text file
3. Copy the sql code in the readMe text file and run it in your mysql work bench or phpmyadmin.
4. Open your web browser and run the index.php file
5. Voila!!, you have successfully imported a csv file.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.