Getting data from Excel in web server


#1

[php]require_once ‘Excel/reader.php’;
$data = new Spreadsheet_Excel_Reader();
$data->setUTFEncoder(‘iconv’);
$data->setOutputEncoding(‘utf-8’);
$data->read(‘Sample.xls’);
error_reporting(E_ALL ^ E_NOTICE);
$mynull=NULL;
for ($i = 2; $i <= $data->sheets[0][‘numRows’]; $i++) {
$param=$data->sheets[0][‘cells’][$i][5];
$query=$dbpdo->prepare(“INSERT INTO table (field) VALUES(?)”);
$sorgu->bindParam(1,$param,PDO::PARAM_STR);
$sorgu->execute();
}[/php]
I have 2 problems. I am using this code for export fields from Excel to MySql. When i run this codes on local server it is working perfectly. But when I run it on web server it isn’t get all data in Excel. For example, in Excel I have 5000 data but it is saving 1000 data to MySql. When I want to UPDATE fields from another Excel file, it is working o local server but in the web server it isn’t working. A different problem from this is I am using $data->read(‘C:/Files/Sample.xls’); path in local server. How can i use this in web server? I readed a lot of things about it but didn’t find any solution. Can you help me?


#2

For the path issue, you need the path of the file on the server.

For the other issue. It may be timing out, or the number of rows may be giving a different number, hard to tell.