Advertisement
Guest User

Untitled

a guest
Mar 29th, 2023
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. $file = fopen($fname,"r");
  2. while(! feof($file))
  3. {
  4. $data = fgetcsv($file);
  5. if ($data[0] == "BEGINNING OF DESIRED DATA")
  6. {
  7. while(! feof($file))
  8. {
  9. $data = fgetcsv($file);
  10. $desc = $data[1].' '.$data[2];
  11. $sql = "INSERT IGNORE INTO database (date, type, desc, tot) VALUES ('$date','$data[0]', '$desc', '$data[12]')";
  12. if ($data[0] != "END OF DESIRED DATA")
  13. {
  14. if ($conn->query($sql) === TRUE)
  15. {
  16. $addOne = $conn -> affected_rows;
  17. $howMany = $howMany + $addOne;
  18. $howMany+1;
  19. }
  20. }
  21. if ($data[0] == "END OF DESIRED DATA")
  22. {
  23. break;
  24. }
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement