...We are here to say something...

How to Import Data from CSV File to Mysql using PHP as a Front end

Please follow the given rules to export CSV file into MySQL using PHP as a front end.

connect.php
--------------------------

$connect = mysqli_connect("localhost", "root", "", "data_import");
?>

--------------------------------
im.php
--------------------------------

if(isset($_POST["submit"]))
{
if($_FILES['file']['name'])
{
$filename = explode(".", $_FILES['file']['name']);
if($filename[1] == 'csv')
{
$handle = fopen($_FILES['file']['tmp_name'], "r");
while($data = fgetcsv($handle))
{
$item1 = mysqli_real_escape_string($connect, $data[0]);
$item2 = mysqli_real_escape_string($connect, $data[1]);
$query = "INSERT into rr(reez, raiyan) values('$item1','$item2')";
mysqli_query($connect, $query);
}
fclose($handle);
echo "";
}
}
}
?>

----------------------------------------------------
index.php --------------------------------



How to export CSV file into MySQL using PHP | Masud Ali Reza




How to Import Data from CSV File to Mysql using PHP














By :Md. Masud Ali Reza

Email : masud.al@gmail.com
Date/time : 26/05/2020

  ID : 1
  Name : Dr. Mostafa
  Email : info@ahmmostafakamal.com
  Answer : How to Import Data from CSV File to Mysql using PHP as a Front end Comments : Its just a comment or description. You should make a tutorial for better understanding of the respective audiences.
  Date/Time : 31/05/20 10:13:04

  ID : 2
  Name : Masud
  Email : masud.al@gmail.com
  Answer : Thank you for your advice, I am trying and already published :https://www.youtube.com/watch?v=u9VTuk70bt8&t=91s
  Date/Time : 03/06/20 10:06:45

  ID : 3
  Name :
  Email :
  Answer :
  Date/Time : 22/07/20 08:07:03


Name :
Email :
Answer :
 

Login