I need to import TEST.TXT (located in the same directory as my script
It has 1 Record: "6","Lunch","234"
Iget this error message: Warning: mysqli_close() expects exactly 1 parameter, 0 given in C:\wamp\www\test\import.php on line 19
Why?
Heres my script:
<?php
// Connect to the MySQL server and select the corporate database
$mysqli = new mysqli("localhost","user,"password,"test");
// Open and parse the test.txt file
$fh = fopen("test.txt", "r");
while ($line = fgetcsv($fh, 1000, ","))
{
$id = $line[0];
$item = $line[1];
$price = $line[2];
// Insert the data into the sales table
$query = "INSERT INTO example SET id='$id',
item='$item', price='$price'";
$result = $mysqli->query($query);
}
fclose($fh);
mysqli_close();
?>