Reputation: 581
Why this code doesn't work? Error call in 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 Fatal error: Call to a member function result() on boolean in
Upvotes: 0
Views: 63
Reputation: 2408
Try this
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);
}
Upvotes: 1