为什么这段代码不起作用?错误调用在 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((
试试这个
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);
}