-
Notifications
You must be signed in to change notification settings - Fork 0
/
import_file.php
36 lines (36 loc) · 1.03 KB
/
import_file.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
include("includes/connection.php");
if(isset($_POST["submit_file"]))
{
$file = $_FILES["file"]["tmp_name"];
$file_open = fopen($file,"r");
while(($csv = fgetcsv($file_open, 3000, ",")) !== false)
{
$entry = $csv[0];
$clientname = $csv[1];
$circuitid = $csv[2];
$date = $csv[3];
$contact = $csv[4];
$servicetype = $csv[5];
$technology = $csv[6];
$jobdescription = $csv[7];
$execution = $csv[8];
$status = $csv[9];
$ipaddress = $csv[10];
$physicallocation = $csv[11];
$buildingname = $csv[12];
$buildingid = $csv[13];
$workorder = $csv[14];
$sql="INSERT INTO entrylog VALUES('$workorder','$entry','$clientname','$circuitid','$date','$contact','$servicetype','$technology','$jobdescription','$execution','$status','$ipaddress','$physicallocation','$buildingname','$buildingid')" or die (mysql_error());
$insert= mysqli_query($link,$sql);
if ($insert)
{
header("location:additem.php");
}
else
{
echo "<br>Could not import file, Correct all Errors<br>" . mysqli_error($link);
}
}
}
?>