CakePHP delete() function is not working

Posted by Logic Artist on Stack Overflow See other posts from Stack Overflow or by Logic Artist
Published on 2010-06-10T19:29:13Z Indexed on 2010/06/10 19:33 UTC
Read the original article Hit count: 154

Filed under:
|

Hello, Im just cracking open cakePHP (v1.3.2). I set it up on my local wamp server, seems to work fine except the delete() function doesn't work. I'm following their blog tutorial exactly, its as simple as it can be so I don't understand why its not working.

Heres the function in my PostsController class:

function delete($id = NULL) {    
    $this->Post->delete($id);    
    $this->Session->setFlash('The post with id: '.$id.' has been deleted.'); 

    $this->redirect(array('action'=>'index')); 
} 

The "Delete" link's url looks like http://localhost/posts/delete/id:1 (where the id number matches the particular post, obviously). It redirects and sets the flash message, however there is no number where $id should be in the message, and the post isn't deleted. It seems the proper id is passed through the url, but I don't think it is getting into the function.

I dont get it. Any ideas???

© Stack Overflow or respective owner

Related posts about cakephp

Related posts about delete