Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8756265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:02:25+00:00 2026-06-13T14:02:25+00:00

Very strange, I got code running on my localhost, but when I deployed it

  • 0

Very strange, I got code running on my localhost, but when I deployed it on remote server. it got T_IF error. The code is as follow:

The xxx line is around: $experiment[‘import_result’] = TRUE;

private function do_import($file_info, $ih_id){

    $this->load->library("MY_PHPExcel");
    $inputFileName = $file_info['full_path']; 
    $sheetNames = array('General','Gas', 'Sample', 'Mass Gain', 'Cr'); 

    /**  Identify the type of $inputFileName  **/ 
    $inputFileType = PHPExcel_IOFactory::identify($inputFileName); 
    /**  Create a new Reader of the type that has been identified  **/ 
    $objReader = PHPExcel_IOFactory::createReader($inputFileType); 
    /**  Advise the Reader that we only want to load cell data  **/ 
    $objReader->setReadDataOnly(true);
    /**  Advise the Reader of which WorkSheets we want to load  **/  
    $objReader->setLoadSheetsOnly($sheetNames); 
    /**  Tell the Reader that we want to use the Read Filter  **/  
    //$objReader->setReadFilter($filterSubset);
    /**  Load $inputFileName to a PHPExcel Object  **/ 
    $objPHPExcel = $objReader->load($inputFileName);
    $sheetCount=$objPHPExcel->getSheetCount();

    $experiment = array();
    for($index = 0; $index<$sheetCount; $index++){
        $objPHPExcel->setActiveSheetIndex($index);
        $sheetName = $objPHPExcel->getActiveSheet()->getTitle();
        if($sheetName == 'General'){
            $experiment['general'] = $this->read_general($objPHPExcel, $index, 1);
        }elseif($sheetName == 'Sample'){
            $experiment['sample'] = $this->read_sample($objPHPExcel, $index, 1);
        }elseif($sheetName == 'Gas'){
            $experiment['gas'] = $this->read_gas($objPHPExcel, $index, 1);
        }elseif($sheetName == 'Mass Gain'){
            $experiment['mass'] = $this->read_mass($objPHPExcel, $index, 1);
        }elseif($sheetName == 'Cr'){
            $experiment['cr'] = $this->read_cr($objPHPExcel, $index, 1);
        }
    }


    //if there is format error 
    foreach($experiment as $sheet){
        if(isset($sheet) && !empty($sheet)){
            if(isset($sheet['error']) && !empty($sheet['error'])){
                $experiment['import_result'] = FALSE;
                break 1;
            }elseif(isset($sheet['validation']['validation']) && $sheet['validation']['validation'] == 0){
                $experiment['import_result'] = FALSE;
                break 1;
            }else{
                $experiment['import_result'] = TRUE;
                break 1;
            }
        }
    }

    if($experiment['import_result']){//there is no format error, proceed to import
        //do import into DB
        $import_flag = 0;
        $post_data = $this->input->post();

        if(isset($post_data['import_radio']) && $post_data['import_radio'] == 1){//new 
            $import_flag = $this->m_import->import_experiment_new($experiment, $this->session->userdata('user_id'), $ih_id);
        }elseif(isset($post_data['import_radio']) && $post_data['import_radio'] == 2){//update
            //debug
            //$this->firephp->log('update an existing experiment');
            $import_flag = $this->m_import->import_experiment_update($post_data['import_eid'], $experiment, $this->session->userdata('user_id'), $ih_id);
        }else{//didn't choose a mode
            return array('status'=>4, 'message'=>'Please select "new" or "update".');
        }

        if($import_flag != 0){//import done ok
            if($post_data['import_radio'] == 1){
                return array('status'=>1, 'message'=>'File has been successfully imported, the new experiment ID is '.$import_flag.'.');
            }else{
                return array('status'=>1, 'message'=>'File has been successfully imported, Experiment'.$import_flag.' has been updated.');
            }
        }else{//validation ok, import fail
            return array('status'=>2, 'message'=>'Something went wrong during the process of importing, please try again.');
        }
    }else{
        //return experiment with errors which are to be presented in view
        $return_error = array();
        $return_warning = array();
        foreach($experiment as $name => $sheet){
            if(isset($sheet['validation'])){
                foreach ($sheet['validation']['error'] as $item){
                    array_push($return_error, $item);
                }
                foreach($sheet['validation']['warning'] as $item){
                    array_push($return_warning, $item);
                }
            }
        }
        //if(!empty($temp_interval_match_error)){   array_push($return_error, $temp_interval_match_error); }
        return array('status'=>3, 'message'=>'The file has invalid cells, please correct the file according to the following hints.',
                    'error' => $return_error, 'warning'=>$return_warning);
    }
}//end of fn do_import()

Please help to locate the problem. Many thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:02:27+00:00Added an answer on June 13, 2026 at 2:02 pm

    Problem Solved. I remove the code block by block and finally figure it out that when I uploading the file, one of the if statement has been accidently commented out by the comments just above it. I guess it might be something wrong about the server. Weird.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today I've got a stacktrace with a very strange error. Actually, I may be
I've got a very strange g++ warning when tried to compile following code: #include
I got a very strange error on my android apk that only appears if
I've got a very strange problem recently. I have a code which processes inApp
I am getting a very strange error when running a spec: Failure/Error: entity =
I got very strange problem. I have one php website which is running in
A very strange situation, I've got this code that is supposed to make an
I got very strange bug on IE. I used the code below to make
Found very strange behavior of MS Access database when running queries from c#. It
This is a very strange problem. I've got a rails app in which I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.