solved: i missed ; in echo file
I am new to php, i have succesfully loaded data into sql using input textbox in html but i am unable to load the same into database by reading csv file and i am getting parse error for the fopen function. pls help
upload.php
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "ib";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} else
$file=$_FILES["file"]["tmp_name"];
echo $file
fopen($file, 'r');
while (($emapData = fgetcsv($file, 10000, ",")) !== FALSE)
$sql = "INSERT into ib(atmid,location,zone,cash,fault) values('.$emapData[0]','.$emapData[1]','.$emapData[2]','.$emapData[3]','.$emapData[4])";
$conn->query($sql);
}
fclose($test);
echo "CSV File has been successfully Imported.";
?>