Reading .csv file in php

前端 未结 8 969
面向向阳花
面向向阳花 2020-12-16 15:12

I want to read .csv file in PHP and put its contents into the database. I wrote the following code:

$row = 1;
$file = fopen(\"qryWebsite.csv\", \"r\");
while         


        
8条回答
  •  生来不讨喜
    2020-12-16 15:29

    You can try the below code. It works perfect for me. I have comment to make it more understandable. You can take reference from this code.

    Entered data having id = " .$id. " successfully


    "; $id++; } echo "

    Congratulation all data successfully inserted

    "; fclose($handle); } //close the connection mysql_close($conn);

提交回复
热议问题