Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 3 application with different behavior on Apache and Microsoft ISS
#1

Codeigniter 3 application with different behavior on Apache and Microsoft ISS

I would like some help from you. It's the following, i developed an application in Codeignite 3 and i have a method that calls a page to display the data for editing, in the controller there is an if to check if the record id was passed, if not passed a message is displayed with a redirect.

In a local development server it works perfectly, if an id was informed, the query is made in the database and the data is displayed in the view and in a production server the application has a different behavior, if an id was informed the query is performed, the data is displayed in the view and the message inside the else is also displayed.

I updated the MySql and PHP versions on the development and production server to be the same, but the problem still persists on the production server.

Localhost: Apache 2.4.41, PHP 8.0.7, MySql 8.0.19
Production server: Microsoft-IIS 8.5, PHP 8.0.7, MySql 8.0.19

Below is part of the code:

// Controller
public function Edit()
{
    $id = $this->uri->segment(3);

    if ($query = $this->Brand_model->GetId($id)):
        $brand = $query;
    else:
        $this->session->set_flashdata('Select a record to edit');
        redirect('brand');
    endif;

    $data = array(
        'page' => 'Edit Brand',
        'brand' => $brand
    );

    $this->load->view('edit-brand', $data);
}

// Model
public function GetId($id = 0)
{
    $this->db->where('id', $id);
    $query = $this->db->get('brand');
    if ($query->num_rows() == 1):
    return $query->row();
    else:
    return NULL;
    endif;
}
Reply




Theme © iAndrew 2016 - Forum software by © MyBB