Question: Everything seems to work just fine but I keep getting the following error:
==========================================================================

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: models/ordermodel.php

Line Number: 24

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: models/ordermodel.php

Line Number: 31

================================================================

In the view i just echo $company\_name 

Controller:

```
            $city = $this->ordermodel->get_city($order_reference);
            $customerCompanyName = $this->ordermodel->get_company_name($order_reference);
            $data['company_name'] = $customerCompanyName;

```

Model:

```
function get_city($ordernumber) {
    $this->db->where('order_number', $ordernumber);
    $city = $this->db->get('order');

    return $city->row()->city;
}

function get_company_name($ordernumber) {
    $this->db->where('order_number', $ordernumber);
    $companyname = $this->db->get('order');

    return $companyname->row()->company_name;
}

```

Answer: 
Use ther`result()` method, it should elimiate all of your errors

`$row = $city->result(); return $row->city;`
Seem that your query has no results, try:

```
function get_company_name($ordernumber) {
    $this->db->where('order_number', $ordernumber);
    $companyname = $this->db->get('order');

    if ($companyname->num_rows() > 0) {
        return $companyname->row()->company_name;
    }
    else {
        return '';
    }
}

```