我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

CakePHP3错误解析数据库结果集

In my controller i have:

public function index()
{
    $streams = $this->Streams->find('all')->where(['user_id'=>2]);

    echo $streams->count();
    die();
    $this->set('streams', $streams);
}

When I set a user_id that has results in databse, it works fine. But when I set a user_id with not results, when I tried to loop the query or even count the results, i get the following error:

InvalidArgumentException Cannot convert value to bool

cakephp3 database error

Any ideas? Thanks all!

近期文章

  • PHP:购物车计算失灵
  • 在变量中使用where
  • too long
  • WordPress函数中的HTTP希望避免https重定向
  • 如何从用户目录的根目录开始获取FTP路径?
  • 特殊字符在浏览器中正确显示,但在phpMyAdmin中加扰
  • 无法在<item>标记中的rss Feed中添加链接或图像
  • 如何每隔几秒从基于http的api解析数据?
  • 在PHP中获取查询字符串参数
  • 如何在骨干js中解析视图中的消息
  • 使用javascript ajax post方法的未定义的偏移PHP错误
  • 我的Wordpress站点中的Polylang和永久链接
  • 点击自定义按钮时触发事件
  • 表单操作未重定向到路由
  • 在Json中使用Listview的问题
  • 如何使用SQL禁止竞争条件1. SELECT,2。<change value>,3。UPDATE?
  • Docusign PHP客户端 - 检查收件人是否已签署该文档
  • 根据部门用户选择接收多个电子邮件地址的Wordpress Contactform7查询
  • 如何用PHP显示transact SQL动态数据结果?
  • 如何使用路由命名空间Laravel对Controller进行分组

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华