Tuesday, March 20, 2012

not Insert records

Hello all,

I am using this function in controller, but when i run copy action at that time this function sis not insert records in my database

why?

public function copyClick($id = null) {
$this->loadModel('Click');
$clickDetail = $this->Click->findById($id);
if($clickDetail)
{
$click = $this->Click->create();
$click['Click']['id'] = null;
$click['Click']['name'] = $clickDetail['Click']['name'];
$click['Click']['user_id'] = $clickDetail['Click']['user_id'];
print_r($click);
//echo $this->Click->cloneReco($id);
exit;
if ($this->Click->save($click)) {
$this->Session->setFlash('New Records is inserted.');
} else {
$this->Session->setFlash('Error-in Insert');
}
exit;
$this->redirect(array('action' => 'myclicks'));
}
else {
$this->Session->setFlash('Error in Delete');
$this->redirect(array('action' => 'myclicks'));
}
}

Database is 

id, name, user_is
1, xyz, 1
2, xyx, 1
3, asa , 1

--
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: