SELECT rows WHERE a JSON column contains a specific property value using CodeIgniter's query builder
12:32 05 Nov 2019

See in the image where you can check the records. player1 field records are in json format. I want to get the record accordingly the phoneNumber which field are inside player1 column. I had tried to fetch the record on condition like.

public function cmplFirstRdDetails($userMobileNo)
{
    $this->db->from('records');
    $this->db->like('player1', '{"PhoneNumber":"$userMobileNo"}');
    $query = $this->db->get();
    return $query->result();
}

This code is not working for me.

php json codeigniter codeigniter-3 query-builder