Mysql cakephp调试函数结果';日期'=&燃气轮机';提供的值无效';
我想在cakephp上保存数据库中的一些数据 这是我的模板Mysql cakephp调试函数结果';日期'=&燃气轮机';提供的值无效';,mysql,cakephp,Mysql,Cakephp,我想在cakephp上保存数据库中的一些数据 这是我的模板 echo $this->Form->create(); echo $this->Form->input('outtime', array( 'class' => 'outtime', 'id' => 'outtime', 'name' => 'outtime' ) ); echo $this->Form->input
echo $this->Form->create();
echo $this->Form->input('outtime',
array(
'class' => 'outtime',
'id' => 'outtime',
'name' => 'outtime'
)
);
echo $this->Form->input('out date',
array(
'class' => 'datepicker0',
'id' => 'outdate',
'name' => 'outdate'
)
);
echo $this->Form->input('return date',
array(
'class' => 'datepicker0',
'id' => 'returndate',
'name' => 'returndate'
)
);
echo $this->Form->button(__('submit'));
echo $this->Form->end();
这是我的数据库模板
当我使用保存功能时,它不起作用,我在代码中使用了调试功能
if ($this->Outs->save($out)) {
$this->Flash->success(__('The out has been saved.'));
} else {
debug($out->errors()); die;
$this->Flash->error(__('The out could not be saved. Please, try again.'));
}
当我运行它时,结果是
我的完整方法代码。。。
公共函数addout()
我的调试输出是。。。
我希望这些信息对你有帮助。
我不知道关于这个错误的任何事情,请帮助我你在两个输入上有空格
过期
和返回日期
,还有CakePHP表单帮助程序自动设置字段属性:name和id,所以如果你不知道你在做什么,不要手动添加。在调用save方法之前,在控制器上尝试debug($this->request data);退出代码>我检查了每件事,我发布的数据都是正确的,你能再给我一些指导吗?在你的问题中添加调试输出和完整的控制器方法。你在两个输入上有空格过期
和返回日期
,还有CakePHP表单助手自动设置字段属性:name和id,所以,如果你不知道自己在做什么,就不要手动添加。在调用save方法之前,在控制器上尝试debug($this->request data);退出代码>我检查了每件事,我发布的数据都是正确的。你能再给我一些指导吗?在你的问题中添加调试输出和完整的控制器方法。
{
$uid = $this->Auth->User()['id'];
$out = $this->Outs->newEntity();
if ($this->request->is('post')) {
$out = $this->Outs->patchEntity($out, $this->request->data);
$this->request->data['user_id'] = $uid;
}
if ($this->Outs->save($out)) {
$this->Flash->success(__('The out has been saved.'));
} else {
debug($this->request->data); exit;
$this->Flash->error(__('The out could not be saved. Please, try again.'));
}
}