从前端将数据保存到数据库时出错

时间:2019-02-19 16:18:04

标签: php magento-1.9

不从前部将数据保存在数据库中。我不明白你哪里错了。

致命错误:在第6120行的/var/www/d/dev-romanl/web/includes/src/__default.php中的非对象上调用成员函数beginTransaction() IndexController.php

<?php
class RonisBT_Feedback_IndexController extends Mage_Core_Controller_Front_Action{

    public function indexAction(){
        $this->loadLayout();
        $this->renderLayout();
    }
ublic function postAction()
    {

        $data = $this->getRequest()->getPost();
        $session = Mage::getSingleton('core/session');
        $person = Mage::getModel('feedback/block');
        $person->setData('name', $data['name']);
        $person->setData('email', $data['email']);
        $person->setData('phone', $data['phone']);
        $person->setData('subject', $data['subject']);
        $person->setData('massage', $data['massage']);
        $person->setData('status', '1');
        $person->setData('user_agent', $data['user_agent']);
        $person->setData('remote_ip', $data['remote_ip']);
        $person->setData('created_at', date("Y-m-d H:i:s"));
        $person->setData('update_at', '');
// $person->setData($data);
        try{
            $person->save();
            $session->addSuccess('Add a person sucessfully');
        }catch(Exception $e){
            $session->addError('Add Error');
        }
        $this->_redirect('feedback/index/index');
   }
}

模型/资源

<?php
class RonisBT_Feedback_Model_Resource_Block extends Mage_Core_Model_Mysql4_Abstract{
    public function _construct()
    {
        $this->_init('feedback/block', 'feedback_id');
    }
}

0 个答案:

没有答案