<?php
$con = mysqli_connect("localhost","root","","addressbook");
$file="localhost/IMDBAPI/-title.ratings.tsv";
$row = 1;
if (($handle = fopen($file, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000000, "\t")) !== FALSE) {
$num = count($data);
$row++;
$id=$data[0];
$name=$data[1];
$address=$data[2];
$phone=$data[3];
$sql="INSERT INTO adress (First_Name, Surname, Address) VALUES ('".$name."','".$address."','".$phone."')";
mysqli_query($con, "SELECT * FROM adress");
}
}
fclose($file);
?>
I have a TSV file named title.ratings.tsv and I am trying to insert values from that file into a MySQL table named adress (yes it is spelled incorrectly) into the columns First_Name, Surname, Address but I am getting the error ,
( ! ) Warning: fopen(localhost/IMDBAPI/-title.ratings.tsv): failed to open stream: No such file or directory in C:\wamp64\www\tsv.php on line 9
And,
( ! ) Warning: fclose() expects parameter 1 to be resource, string given in C:\wamp64\www\tsv.php on line 25