Advertisement
Benvu

import.php

Feb 25th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2.  
  3. include 'dbConfig.php';
  4. $row = 1;
  5.  
  6. if(isset($_POST['importSubmit']))
  7. {
  8. $file = $_FILES['file']['tmp_name'];
  9. $csvFile = fopen($file,"r");
  10. while(($csv = fgetcsv($csvFile,1000,",")) !== FALSE)
  11. {
  12. $num = count($csv);
  13. if ($csv[0] != NULL) {
  14. $row++;
  15. $csv0 = explode("#", $csv[0]);
  16. }
  17.  
  18. $tanggal = $csv[0];
  19. $waktu = $csv[1];
  20. $waktu_berakhir = $csv[2];
  21. $camera = $csv[3];
  22. $counter = $csv[4];
  23. $result = $csv[5];
  24.  
  25. $db->query("INSERT INTO teest(tanggal,waktu,waktu_berakhir,camera,counter,result) VALUES ('$tanggal','$waktu','$waktu_berakhir','$camera','$counter')");
  26.  
  27.  
  28. }
  29. /*
  30. if($sql)
  31. {
  32. echo 'data uploaded';
  33. }
  34. */
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement