Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/08/2012, 13:20
Avatar de lekuack
lekuack
 
Fecha de Ingreso: agosto-2012
Ubicación: Cabrero
Mensajes: 35
Antigüedad: 11 años, 8 meses
Puntos: 0
Problema al Insertar en la DB con Zend

Hola tengo un problema al inserta en la DB me da el siguiente error

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);        
    }
}
y en el controlador tengo lo siguiente

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);
           }
       }
    }
}