Cita:
Fatal error: Call to undefined function insertar() in C:\xampp\htdocs\Game\application\modules\default\c ontrollers\IndexController.php on line 29
El modelo es el siguiente
Código PHP:
<?php
class Default_Model_DbTable_Usuario extends Zend_Db_Table_Abstract
{
protected $_name = 'usuario';
public function get($id)
{
$id = (int) $id;
$row = $this->fetchRow('id = ' . $id);
if (!$row)
{
throw new Exception("Could not find row $id");
}
return $row->toArray();
}
public function insertar($usuario, $clave, $email, $registro)
{
$data = array('usuario' => $usuario, 'email' => $email,
'clave' => $clave, 'registro' => $registro);
$this->insert($data);
}
}
Código PHP:
<?php
class Default_IndexController extends Zend_Controller_Action
{
public function init()
{
$this->view->title = ":: Mi web ::";
$this->view->headTitle($this->view->title);
$this->initView();
$this->view->baseUrl = "/Game/public";
$cont = $this->getRequest()->getControllerName();
$this->view->controller = $cont;
}
public function indexAction()
{
$form = new Default_Form_Registro();
$this->view->form = $form;
if ($this->getRequest()->isPost()){
$formData = $this->getRequest()->getPost();
if ($form->isValid($formData)){
$usuario = $form->getValue('usuario');
$email = $form->getValue('email');
$clave = $form->getValue('clave');
$registro = "2012-08-29";
$usuarios = new Default_Model_DbTable_Usuario();
$usuarios = insertar($usuario, $clave, $email, $registro);
$this->_helper->redirector('index');
}
else
{
$form->populate($formData);
}
}
}
}