将excel电子表格导入到不在mac中工作的mysql数据库

时间:2017-08-17 13:12:22

标签: php mysql html5

嗨我的代码在PC上工作正常,但它在Mac上不起作用如果我有5行数据,所有行都正确地插入PC,但唯一的一行字段是在mac os中插入。

if(isset($_POST["submit"])) {
    $file = $_FILES['file']['tmp_name'];
    $handle = fopen($file, "r");
    $c = 0;
    while(($filesop = fgetcsv($handle, 1000, ",")) !== false) {
        $ID = $filesop[0];                                                                          $team = $filesop[1];
        $publisher = $filesop[2];
        $magazine = $filesop[3];


        $sql = mysql_query("INSERT INTO logsheet 
                                (ID,team,publisher,magazine) 
                        VALUES ('".$ID."','".$team."',
                                '".$publisher."','".$magazine."')");
        $c = $c + 1;
    }

    if($sql){
        echo "You database has imported successfully. You have inserted ".$c ." recoreds";
    }else{
        echo "Sorry! There is some problem.";
    }
}

哪里出错了。

0 个答案:

没有答案