使用PHP在MySQL中导入.xsl和.csv文件

I'm having an issue with CSV import to MySQL database:

<div style="border:1px dashed #333333; width:300px; margin:0 auto; padding:10px;">    
<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;
    **while(($filesop = fgetcsv($handle, 1000, ",")) !== false)
    {
        $name = $filesop[0];
        $email = $filesop[1];           
        $sql = mysql_query("INSERT INTO selleruser (emailid, pass) 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.";
        }
   }?>

    </div>

I'm getting this error:

Undefined offset: 1 at thish line $email = $filesop1;

How can I import my .xsl file into the MySQL database. enter image description here

It looks like you have the issue with delimiter.

fgetcsv($handle, 1000, ",")

I can reproduce this issue if I save the file with delimiter ";". Thus, you may find with what delimiter file was saved and use it:

<?php
function detectDelimiter($csvFile)
{
    $delimiters = array(
        ';' => 0,
        ',' => 0,
        "\t" => 0,
        "|" => 0
    );

    $handle = fopen($csvFile, "r");
    $firstLine = fgets($handle);
    fclose($handle); 
    foreach ($delimiters as $delimiter => &$count) {
        $count = count(str_getcsv($firstLine, $delimiter));
    }

    return array_search(max($delimiters), $delimiters);
}
#print_r(detectDelimiter('chart_column.csv'));


$handle = fopen('chart_column.csv', "r");
$delimiter = detectDelimiter('chart_column.csv');
echo "I checked file and found that its delimiter is \"$delimiter\". Will use it further. 
";

$c = 0;
while(($filesop = fgetcsv($handle, 1000, $delimiter)) !== false)
    {
        $name = $filesop[0];
        $email = $filesop[1];           
        echo "emailid = $name , pass = $email
";
#        $sql = mysql_query("INSERT INTO selleruser (emailid, pass) VALUES ('$name','$email')");
        $c = $c + 1;
    }

As a result I've got:

~$ cat chart_column.csv 
emailid;pass
asd;asd
fdga;ewrdf
asdf;56gfh
fgh5;fgh
dfg;dfgdf
dfg;dfgdf

~$ php delimiter.php
I checked file and found that its delimiter is ";". Will use it further. 
emailid = emailid , pass = pass
emailid = asd , pass = asd
emailid = fdga , pass = ewrdf
emailid = asdf , pass = 56gfh
emailid = fgh5 , pass = fgh
emailid = dfg , pass = dfgdf
emailid = dfg , pass = dfgdf

Hope, this will help.