Zend - error when trying to delete from database.

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
avibitton
Forum Newbie
Posts: 18
Joined: Sat Jul 14, 2012 4:35 pm

Zend - error when trying to delete from database.

Post by avibitton »

Hi
im trying to make the tutorial of http://akrabat.com/zend-framework-tutorial/ its making an album , suppose to be easy one , but i guess i can mass it up ,
if some can help me understand what i was doing wrong it will be great .thanks in advanced .Avi.

in the step of delte album from this tutrial , im getting error as soon as i click on the delte action . thats the error :

An error occurred
Page not found
Exception information:

Message: Action "delete" does not exist and was not trapped in __call()
Stack trace:

#0 /var/www/_zend/library/Zend/Controller/Action.php(518): Zend_Controller_Action->__call('deleteAction', Array)
#1 /var/www/_zend/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('deleteAction')
#2 /var/www/_zend/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#3 /var/www/_zend/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#4 /var/www/_zend/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#5 /var/www/contact/public/index.php(26): Zend_Application->run()
#6 {main}

Request Parameters:

array (
'controller' => 'index',
'action' => 'delete',
'id' => '1',
'module' => 'default',
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Zend - error when trying to delete from database.

Post by requinix »

You didn't implement a deleteAction() in your controller. You need to if you want to use it.
avibitton
Forum Newbie
Posts: 18
Joined: Sat Jul 14, 2012 4:35 pm

Re: Zend - error when trying to delete from database.

Post by avibitton »

it was in indexController but still im getting this error ,thats why i think its weird :

Code: Select all

public function delteAction()
    {
        // action body
        if ($this->getRequest()->isPost()) {
			$del = $this->getRequest()->getPost('del');
			if ($del == 'Yes') {
				$id = $this->getRequest()->getPost('id');
				$albums = new Application_Model_DbTable_Albums();
				$albums->deleteAlbum($id);
			}
			$this->_helper->redirector('index');
			} 
			else {
				$id = $this->_getParam('id', 0);
				$albums = new Application_Model_DbTable_Albums();
				$this->view->album = $albums->getAlbum($id);
			}
    	
    }
Last edited by Benjamin on Mon Jul 23, 2012 5:17 am, edited 1 time in total.
Reason: Added [syntax=php||htm||css||javascript||sql||etc] - Please use [syntax] tags when posting code in the forums! Thanks.
avibitton
Forum Newbie
Posts: 18
Joined: Sat Jul 14, 2012 4:35 pm

Re: Zend - error when trying to delete from database.

Post by avibitton »

i found the problem , i misspelled it, i wrote delteAction(missing "e" after the "l") and not deleteAction.
thank you very much .
Post Reply