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

  • Home
  • SEARCH
  • 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 5982145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:02:41+00:00 2026-05-22T22:02:41+00:00

I’m working with the Zend framework, backed by MySQL, and trying to set up

  • 0

I’m working with the Zend framework, backed by MySQL, and trying to set up an index view. However, with the code I have, I keep getting the “call to a member function on a non-object” error and I don’t know how to solve it. Here’s the Controller for my index page:

 public function indexAction() {
     $dImage = new Application_Model_DImage();
 }

Here’s the code for the DImage model that it references:

public function getImageDesCol ($Id) {
    return $this->getDb()->fetchCol("SELECT description FROM d_image WHERE d_id = ?", $Id);
}

Finally, here’s the source of my Index view page where I’m trying to display the values from the DImage model:

  <?php $description = $this->dImage->getImageDesCol($id) ?>
  <label><?php echo $description[0] ?></label>

When I load that page, I get the “Call to a member function getImageDesCol() on a non-object” error instead of a rendered page. Since I’m new to the Zend framework and PHP in general, I feel like there’s something obvious that I’m missing. What can I do to fix this?

  • 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-05-22T22:02:42+00:00Added an answer on May 22, 2026 at 10:02 pm

    You must add the Application_Model_DImage object to the view, or else the view does not know of an object with that name. Do this:

    public function indexAction()
    {
        $dImage = new Application_Model_DImage();
        $this->view->dImage = $dImage;
    }
    

    Then you will have your $dImage available to your view scripts.

    Your view scripts execute in the context of a Zend_View object, but you were creating your Application_Model_DImage object in the context of your controller (an instance of Zend_Controller_Action). As such, you need to explicitly pass to the view whatever objects the view scripts will use. By default, Zend_Controller_Action has a view object ready for you (check here).

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

Sidebar

Related Questions

I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,

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.