未定义索引:cakephp 中的用户类型名称
Undefined index: usertypename in cakephp
控制器部件代码
$Viewcustomer=$this->Viewcustomer->query("SELECT GROUP_CONCAT(usertype_name SEPARATOR ',') as usertypename, customer_name FROM `pre`.`customer` AS `Viewcustomer` WHERE `Viewcustomer`.`customer_status` = 0 AND `Viewcustomer`.`customer_type` = 'B1'
GROUP BY `customer_id` DESC");
$this->set("Viewcustomer",$Viewcustomer);
查看零件代码
foreach($Viewcustomer as $customers){
echo $customers['Viewcustomer']['usertypename'];
}
usertypename
不应该进来$customers['Viewcustomer']['usertypename'];
这应该是
$customers['0']['usertypename'];
请打印您的数组并分享您的代码
控制器部件代码
$Viewcustomer=$this->Viewcustomer->query("SELECT GROUP_CONCAT(usertype_name SEPARATOR ',') as usertypename, customer_name FROM `pre`.`customer` AS `Viewcustomer` WHERE `Viewcustomer`.`customer_status` = 0 AND `Viewcustomer`.`customer_type` = 'B1'
GROUP BY `customer_id` DESC");
$this->set("Viewcustomer",$Viewcustomer);
查看零件代码
foreach($Viewcustomer as $customers){
echo $customers['Viewcustomer']['usertypename'];
}
usertypename
不应该进来$customers['Viewcustomer']['usertypename'];
这应该是
$customers['0']['usertypename'];
请打印您的数组并分享您的代码