I’m using PHPExcel to import a list of data from MS Excel (97-2003) into MySQL. I wrote the code as follows:
$objExcel = new PHPExcel(); $fileType = 'Excel5'; $objReader = PHPExcel_IOFactory::createReader($fileType); $objReader->setReadDataOnly(TRUE); $objReader->setLoadSheetsOnly('Prizes'); $objPHPExcel = $objReader->load('list.xls'); $worksheet = $objPHPExcel->getActiveSheet(); $modelPrize->price = $worksheet->getCellByColumnAndRow(5, $row)->getValue();
The code was fine when I built in development environment (using MS Windows). But, it was going to error when I deployed into testing environment (using Linux) with following error:
PHP Fatal error: Can’t use function return value in write context in /home/<the_page> on line <where_I_wrote_$modelPrize->price = $worksheet->getCellByColumnAndRow(5, $row)->getValue();>
PHP Fatal error: Class declarations may not be nested in /home/lottery/php_framework/Yii-1.1.14/framework/collections/CListIterator.php on line 20
Is there something missing in my code? Is there something I need to check with the server configuration?