I make a new module which is a simply form, but i can not write into the ddbb, because (i think) can not find the model. I have this code in controllers/IndexController.php:

public function createPersonAction() {
    $data = $this->getRequest()->getPost();
    $session = Mage::getSingleton('core/session');
    $landing = Mage::getModel('landing/landing');
    $landing->setData('name', $data['name']);
    $landing->setData('apellido1', $data['apellido1']);
    $landing->setData('apellido2', $data['apellido2']);
    $landing->setData('email', $data['email']);
    $landing->setData('telefono', $data['telefono']);
    $session->addSuccess('Add a person sucessfully');
  }catch(Exception $e){
    $session->addError('Add Error');

But i have this error:

Fatal error: Call to a member function setData() on boolean in \app\code\local\LP\Landing\controllers\IndexController.php on line 28

(Line 28 is --> $landing->setData('name', $data['name']);)

I have all the needed files, this is my tree:


Help please.


It looks like you might have a problem in your module's config.xml file.

It should look something like this:


You'll obviously need to change the <table>lp_landing_db_tablename</table> table name to whatever you specified in your LP/Landing/sql/lp_landing_setup/mysql4-install-0.1.0.php file.

You also may need to rename your install file from mysql4-install-0.1.0.php to install-0.1.0.php for Magento to properly run the setup script.


Yes, great!

The lines that declared the table of the database were missing


Thank you very much.

  • No problem. I'm glad you're back on track. – duttyman Feb 10 '17 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.