|
hello any 1 tell me wt is the problem in my code
it shows me friend is inserted bt data doesnt save in Database; i am able to store data with scaffold. index.ctp <?php echo $this->Form->create('friend'); echo $this->Form->input('Name'); echo $this->Form->input('Mobile'); echo $this->Form->input('Email'); echo $this->Form->end('Save Friend'); ?> <?php echo $this->element('sql_dump'); ?> Controller <?php class FriendsController extends AppController { var $name = 'Friends'; public $components = array('Session'); //var $scaffold; public function index() { if ($this->request->is('post')) { if ($this->Friend->save($this->request->data)) { $this->Session->setFlash('Your Friend has been saved.'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash('Unable to add your Friend.'); } } } Database friends Column Type Null Default Comments id int(10) No name varchar(30) Yes NULL mobile int(11) Yes NULL email varchar(30) Yes NULL -- 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 [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php |
|
Hello All,
how to delete Multiple tables fields values in cakephp 2.0 -- 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 [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php |
|
In reply to this post by Teji
You're using the index action. That is for *listing* all Friends You
should be using the add action. On Fri, May 18, 2012 at 7:35 AM, Teji <[hidden email]> wrote: > hello any 1 tell me wt is the problem in my code > it shows me friend is inserted bt data doesnt save in Database; > i am able to store data with scaffold. > > index.ctp > > <?php > echo $this->Form->create('friend'); > echo $this->Form->input('Name'); > echo $this->Form->input('Mobile'); > echo $this->Form->input('Email'); > echo $this->Form->end('Save Friend'); > > ?> > <?php echo $this->element('sql_dump'); ?> > > Controller > > <?php > class FriendsController extends AppController { > var $name = 'Friends'; > public $components = array('Session'); > //var $scaffold; > public function index() > { > if ($this->request->is('post')) > { > if ($this->Friend->save($this->request->data)) > { > $this->Session->setFlash('Your Friend has been saved.'); > $this->redirect(array('action' => 'index')); > } > else > { > $this->Session->setFlash('Unable to add your Friend.'); > } > } > > } > > Database > > friends > Column Type Null Default Comments > id int(10) No > name varchar(30) Yes NULL > mobile int(11) Yes NULL > email varchar(30) Yes NULL > > -- > 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 > [hidden email] 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 [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php |
| Powered by Nabble | Edit this page |
