Welcome Guest, Not a member yet? Register   Sign In
Annoying call to member function on non-object problem
#1

[eluser]september28[/eluser]
Sorry if this is really obvious but i have been tearing my hair out trying to figue out what i am doing wrong here...
This is the function in my IdiomSearch_model class

Code:
function search() {
        $terms = $this->input->post('searchterms');
        $this->db->select('idiom, slug');
        $this->db->from('idioms');
        $this->db->where('MATCH (idiom) AGAINST ("'.$terms.'")', NULL, FALSE);
        $query = $this->db->get();
        $result = $query->result();
        if($result) {
            return $result;
        }
        return FALSE;
    }

Basically I call this from a controller and then just load the result into an the $data['searchresults'] to send to the template. When i submit the search form all i get is an error: Fatal error: Call to a member function result() on a non-object in /var/www/idm/system/application/models/idiomsearch_model.php on line 18

Its driving me crazy please help!

Thanks,
Dan
#2

[eluser]TheFuzzy0ne[/eluser]
It would really help if you told us what was at line 18. Smile
#3

[eluser]september28[/eluser]
Sorry! Absolutely stupid I am!! I had forgotton to define the field as a fulltext index in mysql. What a plonker!

Dan




Theme © iAndrew 2016 - Forum software by © MyBB