0

I am accessing my login agent database from my android application where its credential accessed using codeigniter but i am facing the above problem along with Message: count(): Parameter must be an array or an object that implements Countable.

I am attaching all my controller and model codes below along with error picture

I tried to access through postman but i encounter the same problem

MODEL
public function agent_login($data){             
    $loginName = $data['loginName'];
    $password = md5($data['password']);
        $this->db->select("agent_id,agent_first_name,CONCAT_WS(' ', agent_first_name, agent_last_name) AS agent_name,agent_company_name,agent_id,agent_bus_level,agent_phone,agent_bus_assistant,agent_bus_number");
        $this->db->from('agent');
        $this->db->where('agent_first_name',$loginName);
        $this->db->where('agent_password',$password);
        $user= $this->db->get()->row();
    return $user;       
}
CONTROLLER
public function agentLogin(){
    $data = $_POST;     
    $result =$this->agent_model->agent_login($data);
    if(count($result)>0){
    } else {
        $result =  Null;
    }               
    print json_encode($result);
}

I expect to get agent details from database

Coeng
  • 59
  • 15

1 Answers1

0

I got a solution A problem was caused by php version it was 7.2 but my system need 5.6

Coeng
  • 59
  • 15