I am trying to execute a find in my script, but I believe my condition is returning false. I am trying to execute a find and pull all records that match the given value in my $data
variable. I have tried to compare the BranchLicense.RegionCode
to $data
but no luck. I have also tried to compare it the _Session['Auth']['User']['region_code']
. The $data
variable is returning the correct value but the script does not return the proper records. What am I doing wrong here? Here is my code.
//echo '<pre>'; print_r($_SESSION); echo '</pre>';
//$this->loadModel('AuthAcl.Users');
$data = $_SESSION['Auth']['User']['region_code'];
//$data = $this->Users->find('all');
$new = $this->BranchLicense->find('all', array(
'conditions' => array('BranchLicense.RegionCode' == $data)));
die(debug($new));
$this->layout = 'default';
//$this->set('branchLicenses', $this->BranchLicense->find('all', array(
//'conditions' => array('BranchLicense.RegionCode' === '$data'))));
Try as follows-
$new = $this->BranchLicense->find('all', array(
'conditions' => array('BranchLicense.RegionCode' => $data)));
die(debug($new));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.