我正在尝试在数据库中导入csv文件,但它显示未定义的偏移1并且它将值存储在db中
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿRoot Entryÿÿÿÿÿÿÿÿ
我不知道为什么。我试图在过去的5个小时内解决这个错误,但是我没想过 这是我的代码
<body>
<form name="import" method="post" enctype="multipart/form-data">
<input type="file" name="file" /><br />
<input type="submit" name="submit" value="Submit" />
</form>
<?php
include ("connection.php");
if(isset($_POST["submit"]))
{
$file = $_FILES['file']['tmp_name'];
$handle = fopen($file, "r");
$c = 0;
$filesop = array();
while(($filesop = fgetcsv($handle, 1000, ",")) !== false)
{
$name = $filesop[0];
$email = $filesop[1];
$sql = mysql_query("INSERT INTO mdl_user (username, email) VALUES
('$name','$email')");
$c = $c + 1;
}
if($sql){
echo "You database has imported successfully. You have inserted
". $c ." recoreds";
}else{
echo "Sorry! There is some problem.";
}
}
?>
</body>
它显示此行中未定义的偏移量1错误
$email = $filesop[1];
任何人都可以帮助我
提前感谢..