Bitwise and MySQL for Pagination
I have a table with a field name department, this field contains bitwise values.
I want to check if the department field is inside the departments allowed to access by the user. But doing the following doesn't work:
$this->Paginator->settings = array( 'conditions' => array('department & ' => $this->Session->read('User.departments')), 'limit' => 10, 'order' => 'date DESC', );
What can I do to solve it?
I think your syntax is incorrect. See Mysql Bitwise operations and filter
'conditions' => array( "ModelName.department & '" . $this->Session->read('User.departments') . "'" )