How to insert value to Magento database using module
Posted
by
Kasmin Nicko
on Stack Overflow
See other posts from Stack Overflow
or by Kasmin Nicko
Published on 2012-12-09T04:59:54Z
Indexed on
2012/12/09
5:03 UTC
Read the original article
Hit count: 194
I want to insert value to the database I created. The value would be insert to post column.
I have code like this in the IndexController.php
class My_Module_IndexController extends Mage_Core_Controller_Front_Action {
public function postAction() {
$post = Mage::getModel('my/model');
$post->setPost('My Post Here');
$post->save();
}
}
But after I ran this script, I got the following error
Fatal error: Call to a member function setPost() on a non-object in C:\xampp\htdocs\magento\app\code\community\My\Module\controllers\IndexController.php on line 7
What is something I miss?
© Stack Overflow or respective owner