diff --git a/admin/bulkupload.html b/admin/bulkupload.html new file mode 100644 index 0000000000000000000000000000000000000000..b53b46523f4dea827e89fe71cd5d0291e6f319d6 --- /dev/null +++ b/admin/bulkupload.html @@ -0,0 +1,49 @@ + + + + + + + + +
+
+
+
+
+ + Bulk Upload of Blood Data + +
+ +
+ +
+
+ +
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ + diff --git a/admin/bulkupload.php b/admin/bulkupload.php new file mode 100644 index 0000000000000000000000000000000000000000..58a2628dddffad3dad3aa15a58fbb78345ad1fc7 --- /dev/null +++ b/admin/bulkupload.php @@ -0,0 +1,47 @@ + 0) + { + $file = fopen($filename, "r"); + while (($getData = fgetcsv($file, 10000, ",")) !== FALSE) + { + $sql = "INSERT into bloo (`id`, `uname`, `blood`, `age`, `mobile`, `city`, `dd`) + values ('$getData[0]','$getData[1]','$getData[2]','$getData[3]','$getData[4]','$getData[5]','$getData[6]')"; + $result = mysqli_query($con, $sql); + if(!isset($result)) + { + echo ""; + } + else { + echo ""; + } + } + + fclose($file); + } + } + if(isset($_POST["Export"])){ + + header('Content-Type: text/csv; charset=utf-8'); + header('Content-Disposition: attachment; filename=data.csv'); + $output = fopen("php://output", "w"); + fputcsv($output, array('ID', 'Donor Name', 'Blood Group', 'Age', 'Mobile', 'City', 'Last Donated Months')); + $query = "SELECT * from bloo ORDER BY id DESC"; + $result = mysqli_query($con, $query); + while($row = mysqli_fetch_assoc($result)) + { + fputcsv($output, $row); + } + fclose($output); } + ?> \ No newline at end of file