为什么这段代码不起作用?在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()
答案 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);
}