Indeed, the error is because you have $this->Post->edit($id); in your controller. If the method name is not found cake sends the method name as an SQL query by default. Simply remove that line and you should be all set.
I encourage you to make sure you type in your controller code as it's laid out for you in the tutorial. I'm not sure where or who told you to type in $this->Post->edit($id); in the controller, as its not in the tutorial: http://book.cakephp.org/view/1540/Editing-Posts Hope that helps, Nick On Jul 9, 4:13 pm, BlaineRumsey <[email protected]> wrote: > Hello, I am new to cake and I am trying to complete the blog tutorial > in the manual for 1.3 for getting started. I am at the edit post > section and I am having a problem. When I click edit I get and sql > syntax error. > > 1064: You have an error in your SQL syntax; check the manual that > corresponds to your MySQL server version for the right syntax to use > near 'edit' at line 1 > > the output sql query is : > > SELECT `Post`.`id`, `Post`.`title`, `Post`.`body`, `Post`.`created`, > `Post`.`modified` FROM `posts` AS `Post` WHERE `Post`.`id` = 1 LIMIT 1 > > which when pasted into the sql cmd editor in myadmin comes out fine no > errors. > > can anyone help me out here? > > details: > > php 5.2.4 > mysql 5.0.24a > > here is my edit function > > function edit($id){ > $this->Post->edit($id); > if(empty($this->Post->data)){ > $this->data = $this->Post->read(); > }else{ > if($this->Post->save($this->data)){ > $this->Session->setFlash('Your post has been > updated.'); > $this->redirect(array('action'=>'index')); > } > } > } > > I appreciate the help. > > BlaineRumsey Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
