I'm trying to import an CSV into mySQL, I'm very new to this, but to my knowledge I've followed exactly what another post on stackoverflow has said and it's still not working.
<?php
$servername = "localhost";
$username = "root";
$password = "password";
$dbname = "test";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$query = <<<eof
LOAD DATA INFILE 'hi.csv'
INTO TABLE testing
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(firstname)
eof;
$db->query($query);
?>
If anyone could help it would be greatly appreciated. With the current code, the error is "Parse error: syntax error, unexpected end of file in (filename) on line 24. But even when error free, it doesn't put new data into mySQL.