there are some defaultness just in place of var we can use varchar On Fri, Sep 9, 2011 at 9:09 PM, Sam Sherlock <sam.sherl...@gmail.com> wrote:
> I added the code from prev post to your code below. > > as you add more controllers you'd be better off adding general comps & > helpers to the app_controller > > - S > > > > > On 9 September 2011 16:21, Jeremy Williams <cop...@gmail.com> wrote: > >> this is my controller. >> >> >> <?php >> class PostsController extends AppController { >> var $name = 'Posts'; >> > var $helpers = array( > 'Form', > 'Html', > 'Session' > ); > >> var $components = array('Session'); >> >> function index() { >> $this->set('posts', $this->Post->find('all')); >> } >> >> function view($id) { >> $this->Post->id = $id; >> $this->set('post', $this->Post->read()); >> >> } >> >> function add() { >> if (!(empty($this->data))) { >> if ($this->Post->save($this->data)) { >> $this->Session->setFlash('Your post has >> been saved.'); >> $this->redirect(array('action' => >> 'index')); >> } >> } >> } >> >> function delete($id) { >> if ($this->Post->delete($id)) { >> $this->Session->setFlash('The post with id: ' . $id >> . ' has been >> deleted.'); >> $this->redirect(array('action' => 'index')); >> } >> } >> function edit($id = null) { >> $this->Post->id = $id; >> if (empty($this->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')); >> } >> } >> } >> >> } >> ?> >> >> -- >> Our newest site for the community: CakePHP Video Tutorials >> http://tv.cakephp.org >> Check out the new CakePHP Questions site http://ask.cakephp.org and help >> others with their CakePHP related questions. >> >> >> To unsubscribe from this group, send email to >> cake-php+unsubscr...@googlegroups.com For more options, visit this group >> at http://groups.google.com/group/cake-php >> > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php