<?php 

$servername = "192.169.232.59";
$username = "atvinter_atv19";
$password = "KoDq(=tt6d}(";
$dbname = "atvinter_dbproject";


// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);

// Check connection
if (!$conn) {
   die("Connection failed: " . mysqli_connect_error());
header('location: error404.php');
}
/* mysqli_close($conn); */
error_reporting(E_ALL & ~E_NOTICE);

date_default_timezone_set("America/Los_Angeles");


$csv = 'in.csv';
$file = fopen($csv, "r");
$a=0;
 while(!feof($file)){
      $data = fgetcsv($file);
      
      if($a != 0){
          $conn->query("UPDATE pto SET ptoearned='".$data[01]."',usedpto='".$data[02]."', availablepto='".$data[03]."' WHERE empid='".$data[0]."' and name='Paid Time Off' ");
          
          echo "UPDATE pto SET ptoearned='".$data[01]."',usedpto='".$data[02]."', availablepto='".$data[03]."' WHERE empid='".$data[0]."' and name='Paid Time Off' <br>";
      }
      $a++;
     
 }
 fclose($file);
 $conn->close();
 


?>