Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 查找返回False的方法_Php_Cakephp 2.4 - Fatal编程技术网

Php 查找返回False的方法

Php 查找返回False的方法,php,cakephp-2.4,Php,Cakephp 2.4,我试图在脚本中执行查找,但我相信我的条件返回false。我正在尝试执行查找并提取与我的$data变量中给定值匹配的所有记录。我试图将BranchLicense.RegionCode与$data进行比较,但没有成功。我还尝试将其与\u会话['Auth']['User']['region\u code']进行比较。$data变量正在返回正确的值,但脚本没有返回正确的记录。我做错了什么?这是我的密码 //echo '<pre>'; print_r($_SESSION); echo '<

我试图在脚本中执行查找,但我相信我的条件返回false。我正在尝试执行查找并提取与我的
$data
变量中给定值匹配的所有记录。我试图将
BranchLicense.RegionCode
$data
进行比较,但没有成功。我还尝试将其与
\u会话['Auth']['User']['region\u code']
进行比较。
$data
变量正在返回正确的值,但脚本没有返回正确的记录。我做错了什么?这是我的密码

//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'))));
//echo';打印(美元会话);回声';
//$this->loadModel('AuthAcl.Users');
$data=$\会话['Auth']['User']['region\u code'];
//$data=$this->Users->find('all');
$new=$this->BranchLicense->find('all',数组(
'条件'=>数组('BranchLicense.RegionCode'==$data));
模具(调试($new));
$this->layout='default';
//$this->set('branchLicenses',$this->BranchLicense->find('all',数组(
//'条件'=>数组('BranchLicense.RegionCode'=='$data');
尝试以下操作-


您是否尝试过获取查找生成的查询,并在数据库上手动运行该查询?通过在/app/Config/core.php中将debug设置为2并添加echo$this->element('sql_dump'),您可以让cake输出它所经历的查询;去输出汉克斯!!我早就试过了,但没用!!哦,好吧!再次感谢!
   $new = $this->BranchLicense->find('all', array(
    'conditions' => array('BranchLicense.RegionCode' => $data)));
    die(debug($new));