I am working on a project in which i need to import data from excelsheet to database.
When i execute a excelsheet it works fine and the data from the excelsheet
is sucessfully imported into the table of database, but a message is dispalyed at the time of code execution.
The code is running fine but at runtime a message displayed ::
ZipArchive Object ( [status] => 0 [statusSys] => 0 [numFiles] => 11 [filename] => C:\xampp\htdocs\bitcoinreports\uploads\data123.xlsx [comment] => )
Here is the code of the controller::
public function execute_excel(){
if(!empty($_POST)){
$file_name = $_FILES['report_file']['name'];
$this->load->library('excel');
ini_set('memory_limit', '-1');
//According to me the problem is occur because of below given 4 lines of code
$objReader = PHPExcel_IOFactory::createReader('Excel5');
$objReader->setReadDataOnly(true);
$path = $_SERVER['DOCUMENT_ROOT'] . '/bitcoinreports/uploads/'.$file_name;
$objPHPExcel = PHPExcel_IOFactory::load($path);
$objWorksheet = $objPHPExcel->setActiveSheetIndex(0);
$allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
$arrayCount = count($allDataInSheet);
for($i=2; $i<=$arrayCount; $i++){
$name = $objWorksheet->getCellByColumnAndRow(0,$i)->getValue();
$email = $objWorksheet->getCellByColumnAndRow(1,$i)->getValue();
$phone = $objWorksheet->getCellByColumnAndRow(2,$i)->getValue();
$details = $objWorksheet->getCellByColumnAndRow(3,$i)->getValue();
$location = $objWorksheet->getCellByColumnAndRow(4,$i)->getValue();
$data_user = array(
"name" => $name,"email" => $email ,"phone" => $phone ,"details" => $details ,"location" => $location);
$checkValue=$this->dashboard_model->check_data($name,$email,$phone,$details,$location);
if($checkValue>0)
{
//echo "Some Statement";
}
else{
$this->dashboard_model->add_data($data_user);
}
}
}
$this->session->set_flashdata('success',"Records Inserted SucessFully !!!");
$data['content'] = "admin/upload/execute_report";
$data['title'] = "Execute Reports";
$data['current_open'] = 'execute_excel';
$data['current_page'] = 'result_add';
$this->load->view('admin/dashboard/common', $data);
}
How to solve this problem ?