Import data in MySQL Date base from upload CSV File using PHP Code

MySQL, PHP, Tutorial 0 Comments

How to upload and parse a CSV file in php code Mysql, Import data in MySQL Date base from upload CSV File using php. How to Import CSV Into MySQL Database Using PHP code script, PHP script code Import Data from CSV File to MySQL Using PHP, How to upload a CSV file using PHP

Import data in MySQL Date base from upload CSV File using php

If you are upload insert Ms excel data in MySQL so first convert Ms excel convert into CSV file and upload in MySQL data


<?php if ($_FILES[csv][size] > 0) {
//get the csv file size
$file = $_FILES[csv][tmp_name];
$handle = fopen($file,"r");
//loop through the csv file upload and insert into database
do {
if ($data[0]) {
mysql_query("INSERT INTO tbl_studyabroad ( username, mob, last, city, exp, test, game, class, classid, addrss, remark, status) VALUES
(
'".addslashes($data[0])."',
'".addslashes($data[1])."',
'".addslashes($data[2])."',
'".addslashes($data[3])."',
'".addslashes($data[4])."',
'".addslashes($data[5])."',
'".addslashes($data[6])."',
'".addslashes($data[7])."',
'".addslashes($data[8])."',
'".addslashes($data[9])."',
'".addslashes($data[10])."',
'".addslashes($data[11])."'

)
");

}
} while ($data = fgetcsv($handle,1000,",","'"));

}

?>

<form action="" method="post" enctype="multipart/form-data" name="form1" id="formid">

<input name="csv" type="file" id="csv" class="form-control boxed" /> <br>

<input type="submit" name="Submit" value="Submit" class="form-control boxed" style="color:#FFFFFF; background-color:#003333" />

</form>

php upload csv file to server using php in mysql, import csv file into mysql using php code, how to upload csv file in php code and store in mysql, import csv file data into mysql database DB using php & ajax, import large csv file into mysql php, export data from mysql table to csv file using php, export csv file in php, upload csv file using ajax in php