İthalat excel mysql veritabanına php dosyası

0 Cevap php

I facing a problem regarding the import of an excel file into mysql through php. i have used phptriad as a local server to test my web application(site). The application imports the excel file present on the client side computer. the code works fine when accessed through local server.

recently i have registered a subdomain at orgfree.com. i have uploaded all the application files onto the site. but 'importing excel file' funtion does not work. it shows 'the file D:\test.xls is not readable' error(test.xls is on my laptop).

ne bu soruna çözüm olabilir? lütfen yardım

Here is the code

require_once 'reader.php';
$excelrow=0;$excelcol=0;                    
function parseExcel($excel_file_name_with_path)
{
    global $excelrow,$excelcol;
    $data = new Spreadsheet_Excel_Reader();
    // Set output Encoding.
    $data->setOutputEncoding('CP1251');
    $data->read($excel_file_name_with_path);
    $colname=array('id','name');                    
    for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++)
        {
            for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++)
            {
              $product[$i-1][$j-1]=$data->sheets[0]['cells'][$i][$j];
              $product[$i-1][$colname[$j-1]]=$data->sheets[0]['cells'][$i][$j];
            }
        }
    $excelrow=$i;$excelcol=$j;
    return $product;
}
$data=parseExcel($file);

for($i=0;$i<$excelrow-1;$i++)
{
    for($j=0;$j<$excelcol-1;$j++)
    {
        $fname=ucfirst(strtolower($data[$i][0]));
        $lname=ucfirst(strtolower($data[$i][1]));
        $gender=ucfirst(strtolower($data[$i][2]));
        $phoneno=$data[$i][3];
            $email=strtolower($data[$i][4]);                            
        $occup=ucfirst(strtolower($data[$i][5]));
        $city=ucfirst(strtolower($data[$i][6]));                
    }
        //THEN INSERT INTO DATABASE THROUGH SQL QUERIES                     
}

Not: Uygulama, yani Yönetici tek bir kullanıcı var.

şimdiden teşekkürler!

0 Cevap