Search code examples
phpcodeignitererror-handlinginternal-server-error

500 Internal Server Error - No Error Log


I had a function that worked just fine. Then i uploaded it to the live server and it gave me a 500 internal server error. After googling people said its an error you get when something(but they arent sure what) is messed up with the server. Not very helpful. others said check your error log. I have no idea how to get to it.

Function that causes the error ===============================

 private function get_workstation () {
  //================ I tried deleting all but this and that got rid of the error== //
    if ($this->input->post('search')) {
        $search = $this->input->post('search');
        $where = 'ad_name ="'.$search.'" AND';
        $this->data['search'] = $search;
    } else {
        $where = '';
    }
    // ================================================================= //
    // Pagination Code //
    $numOfRows = $this->db->query('
        SELECT distinct sys_name 
        FROM v_rollout_sysuser 
        WHERE scope_ID = '. $this->session->userdata('scopeId') .'
    ');

    if ($this->input->get('page')) {
        $pageNum = $this->input->get('page');
    } else {
        $pageNum = 1;
    }

    $limit = ($pageNum - 1 ) * 50;
    $numRows = $numOfRows->num_rows();
    $totalPages = ceil($numRows / 50);

    $this->data['pageNum'] = $pageNum;
    $this->data['prevPage'] = $pageNum - 1;
    $this->data['nextPage'] = $pageNum + 1;
    $this->data['totalPages'] = $totalPages;

    // End of Pagination Code //

    $query = $this->db->query('
        SELECT * 
        FROM v_rollout_sysuser
        WHERE '.$where.' scope_ID = '. $this->session->userdata('scopeId') .'
        GROUP BY sys_name 
        LIMIT '.$limit.',50');

    $i = 0;

    foreach ($query->result() as $row) {
        $i = $i + 1;
        $data['i'] = $i;
        $data['ro_ID'] = $row->ro_ID;
        $data['sys_name'] = $row->sys_name;
        $data['EAM_Model'] = $row->EAM_Model;           
        $data['EAM_User'] = $row->ad_account;
        $data['ad_DispName'] = $row->ad_DispName;
        $data['search'] = $this->input->post('search');

        $systems[] = $data;
    }

    if(isset($systems)) {
        $this->data['systems'] = $systems;
    } else {
        $this->data['systems'] = null;
    }

}

Solution

  • As it turns out there was a problem with the database. Sorry to those who spent time trying to help. The guy running the database found the problem. Thank for trying though.