CI活跃记录。 get() - > result()错误

时间:2016-02-16 05:01:29

标签: php codeigniter activerecord

为什么这段代码不起作用?在foreach中调用错误。

$notifications = $this->db->select('id, shopping_region_id')
        ->from('push_notifications')
        ->where('date<=NOW()')
        ->get()->result();

    foreach ($notifications as $notification)
    {
        $test = $this->db->select('user_id, shopping_region_id')
            ->from('user')
            ->where('shopping_region_id=',$notification->shopping_region_id)
            ->get()->result();

        print_r($test);

    }
  

PHP致命错误:在

中的布尔值上调用成员函数result()

1 个答案:

答案 0 :(得分:1)

试试这个

foreach ($notifications as $notification)
    {
        $test = $this->db->select('user_id, shopping_region_id')
            ->from('user')
            ->where('shopping_region_id' , $notification->shopping_region_id)
            ->get()->result();

        print_r($test);

    }
相关问题