【问题标题】:Undefined index: usertypename in cakephp未定义的索引:cakephp 中的用户类型名
【发布时间】:2016-04-12 10:29:58
【问题描述】:

控制器部分代码

$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'];
    }

【问题讨论】:

  • 我很好奇如何同时使用三个 CakePHP 版本。告诉我?或者修复你的标签。

标签: cakephp cakephp-2.0 cakephp-2.3 cakephp-2.1


【解决方案1】:

usertypename 不应该进来$customers['Viewcustomer']['usertypename'];
这应该是
$customers['0']['usertypename'];
请打印您的数组并分享您的代码

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-04-09
    • 1970-01-01
    • 2018-03-17
    • 1970-01-01
    • 2016-06-10
    • 1970-01-01
    相关资源
    最近更新 更多