php把excel导入mysql 如何用php实现将excel导入到数据库中?

如何用php实现将excel导入到数据库中?我用的代码是: //连接数据库文件 $connect=mysql_connect("localhost","admin","admin") or die("

如何用php实现将excel导入到数据库中?

我用的代码是:

//连接数据库文件

$connect=mysql_connect("localhost","admin","admin") or die("链接数据库失败!")

//连接数据库(test)

mysql_select_db("testcg",$connect) or die (mysql_error())

$temp=file("test.csv")//连接EXCEL文件,格式为了.csv

for ($i=0$i