I got an error

> 
> "Cannot use object of type QueryResult as array"
> 
> 
> 

I am simply trying to take state name from the records array but, I only manage to get this error "Cannot use object of type QueryResult as array"

**Model.php**

```
public function getstatename()
{   
$statename = $this->salesforce->query ("SELECT State__c FROM  RI_School_List__c group by State__c");

return $statename;  
}

```

**Controller.php**

```
public function index() { 
    $data['getstatename'] = $this->model->getstatename();           
    $this->load->view('footer', $data);
    echo "<pre>";
    print_r($data['getstatename']['records']);
}

```