$this->db->select('*');
$this->db->from('details');
if ($country != '')
{
$condition .= "(details.service_location IN ('" . $country . "') OR details.country in ('" . $country . "'))";
}
$this->db->where($condition);
$this->db->where('price_range_from >=', $min_price);
$this->db->where('price_range_to <=', $max_price);
$this->db->order_by("details.created_on", "asc");
$query = $this->db->get();
$results = $query->result();
foreach ($results as $result)
{
$this->db->select('title as image');
$this->db->from('attachments');
$this->db->where('parent', $result-id);
$this->db->where('type', 'job');
$image = $this->db->get()->row();
$result->image = $image->image; // Line No :55
$this->db->select('sum(feedbacks.rate)/count(feedbacks.rate) as average');
$this->db->from('feedbacks');
$this->db->where('parent_id', $result->id);
$this->db->where('type', 'job');
$average = $this->db->get()->row();
$result->average = $average->average;
$result = (object) $result;
}
return $results;
}
if attachment table doesn't have records it shows an error
Severity: Notice
Message: Trying to get property of non-object
Filename: models/details_model.php
Line Number: 55
$result->image = $image->image;