I have a value in my database (int) decimal. I have several constants in my codeigniter application linked to a binary 1 - 2 - 4 - 8 - ... .
I wanted to get all users with a specific binary acces level to be shown.
public function query($level = 0) { $data = NULL;$this->db->select('user_id, user_email, user_name, user_firstname, user_imageammount, user_auth'); $this->db->from('users'); $this->db->where('user_auth' & $level); $query = $this->db->get(); if ( $query->num_rows() > 0 ) { $data = $query->result_array(); } return $data;
}
When i run the query straight in my phpmyadmin i get the results that i need.
SELECTuser_id
,user_email
,user_name
,user_firstname
,user_imageammount
,user_auth
FROMusers
WHEREuser_auth
& 1
When i run it in codeigniter i get a error.
Severity: Warning Message: A non-numeric value encountered
Any help or advice would be appriciated.
#php #mysql #codeigniter