Import Excel to MySQL Using PHP

0
606

This topic is entitled Import Excel to MySQL Using PHP, I believe that this source code will be a big help to everyone who wanted to Import the Excel/CSV file to MySQL Database using PHP. In this project, I use twitter bootstrap framework for the themes and MySQL Database for storing the imported data from excel file. 

Screenshot of this project Import Excel to MySQL Using PHP

Import Excel to MySQL Using PHP
Import Excel to MySQL Using PHP

Steps how to run this project:

Step 1: Download the Full Source code here: excel source code 

Step 2: Extract the downloaded source code and put it in the Document root or in your htdocs folder

Step 3: Create a MySQL Database, Name it as studentdb“.

Step 4: Create a table, use the query below:

  1. CREATE TABLE <code>subject</code> (
  2. <code>SUBJ_CODE</code> varchar(30) NOT NULL,
  3. <code>SUBJ_DESCRIPTION</code> varchar(255) NOT NULL,
  4. <code>UNIT</code> double NOT NULL,
  5. <code>PRE_REQUISITE</code> varchar(30) NOT NULL DEFAULT 'None',
  6. <code>COURSE_ID</code> int(11) NOT NULL,
  7. <code>AY</code> varchar(30) NOT NULL,
  8. <code>SEMESTER</code> varchar(20) NOT NULL
  9. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Step 5: Run your project: copy this link to your browser. http://localhost/excel/index.php

Note:

In order for you to import the excel file, make sure that the format of excel file is set to CSV. You can use the sample csv file located in your main document folder. Please see the image below for your reference. The file is “subject.csv”.

Import Excel to MySQL Using PHP sample CSV file
Import Excel to MySQL Using PHP sample CSV file

 

If you have any questions or suggestion about Import Excel to MySQL Using PHP, Please feel free to contact me at our contact page.

 

Next Topic: Exporting Record from MySQL database to Excel file Using PHP.

Import Excel to MySQL Using PHP Related Topic:

If you find this article useful, please a comment below and share this with your friends who loves to do programming.

Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here