This question already has an answer here:
The function is not working. I would like ot add each line to the mysql database to the description field, and a number to the value field
$fp = fopen($filename,"r");
$number=0;
//parse the csv file row by row
while(($row = fgetcsv($fp,"500",",")) != FALSE)
{
$number++;
//insert csv data into mysql table
$sql = "INSERT INTO 'description' (descID`, `desc`) VALUES($number ,$row)";
if(!mysqli_query($connection, $sql))
{
die('Error : ' . mysqli_error());
}
}
Aucun commentaire:
Enregistrer un commentaire