Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8038991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:25:32+00:00 2026-06-05T03:25:32+00:00

Seems like a common occurance this error on here, Looking at the answers I

  • 0

Seems like a common occurance this error on here, Looking at the answers I still cant quite work out why I’m getting an error.

I am getting the error

Fatal error: Call to a member function result() on a non-object on line 83

The line in question relates to this function in the Controller – This is what’s creating the error.

$this->view_data[‘categories’] = $my_categories->result();

The function is below..

function _load_search_options()
{
    // Get all the categories for the advanced search page
    $my_categories = $this->Categories_model->get_all();
    $this->view_data['categories'] = $my_categories->result();

    // Get all the PRIMARY colours from teh tbl_colour_options
    $my_colour_options = $this->Colours_model->get_all_primary();
    $this->view_data['colour_options'] = $my_colour_options->result();


    // Get all the colours from teh tbl_colour_options
    $my_colour_options_all = $this->Colours_model->get_all();
    $this->view_data['colour_options_all'] = $my_colour_options_all->result();
}

My Model is as follows…

function get_all()
{
    $query_str = "
        SELECT *
        FROM categories
        WHERE CATEGORIES_parent_id = 0
    ";

    $results = $this->db->query($query_str);
    $parents = $results->result();

    foreach ($parents as $parent)
    {
        $children = array();

        $query_str = "
            SELECT *
            FROM categories
            WHERE CATEGORIES_parent_id = '$parent->CATEGORIES_id'
        ";

        $children_results = $this->db->query($query_str);
        $children_results = $children_results->result();

        foreach($children_results as $children_result)
        {
            $children[$children_result->CATEGORIES_id] = $children_result->CATEGORIES_title;
        }

        $categories[$parent->CATEGORIES_title] = $children;




    }

    return $categories;
}

It’s worth noting that running the SELECT query in MySQL on its own brings through some results.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:25:33+00:00Added an answer on June 5, 2026 at 3:25 am

    The function get_all doesn’t return a database object (resource).

    The $categories variable in the get_all function is defined as an array.

    You cannot access it as an object or call the results function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems like it would be a common issue to be but I don't
This seems like it should be obvious but I can't figure it out. Suppose
This seems like a common task, alter some elements of an array, but my
This seems like a common questions but none of them seem to be what
I feel like this is a stupid question because it seems like common sense
This seems like a common use, so I suspect I'm missing something... During my
Ok, so this seems like a common need. A little googling finds a lot
This seems like the most common relationship but for some reason I cannot get
This seems like a common question but search is not returning anything. I have
Seems like cuke doesn't show the full error message (at least when problem occurs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.