When you save your data to DB using Model, some time if fails without any message, you can use codes to check what is happening. If the save fails, you will get print of data, validation error if any, and SQL statement executed.
$data=$this->data;
if ($this->Client->save($data)) {
$this->Session->setFlash("Client Added");
$this->redirect('/clients/listclient/0');
}else{
//to print the data itselft
debug($data);
//to print the Validation Errors
debug($this->validationErrors);
//to print the SQL statements
debug($this->Client->getDataSource()->getLog(false, false));
//to print the invlide fields
debug($this->Client->invalidFields());
}
No comments:
Post a Comment