0
使用cakePhp替換舊版本1.2的現有產品。 我剛開始使用CakePhp。 我試圖將一些數據保存到表中。 這是我的代碼。保存在cakephp 1.2中無法正常工作1.2
function add(){
//echo $id;
pr($this->data);
if(!empty($this->data)){
$this->User->create();
if($this->User->save($this->data)){
debug($this->User->validationErrors);
exit();
$this->Session->setFlash("Data saved man");
$this->redirect(array('action'=>'index',2));
}
}
}
下面是調試數據。
Array
(
[user] => Array
(
[first_name] => hello
[last_name] => man
[email] => [email protected]
[password] => 123
[created_at] => Array
(
[month] => 01
[day] => 17
[year] => 2014
[hour] => 08
[min] => 56
[meridian] => am
)
[modified_at] => Array
(
[month] => 01
[day] => 17
[year] => 2014
[hour] => 08
[min] => 56
[meridian] => am
)
)
)
app\controllers\users_controller.php (line 36)
Array
(
)
(default) 0 query took ms
Nr Query Error Affected Num. rows Took (ms).
我不知道爲什麼數據沒有保存到數據庫。我需要爲版本1.2工作。謝謝
我接受這是由於粗心大意,但我在這裏留下了這個問題,因爲我看到很多朋友重複我的同樣的錯誤。 – lokeshjain2008
這在這種情況下可能會有所幫助。 http://stackoverflow.com/questions/566508/how-to-debug-when-cakephp-modelsave-doesnt-attempt-an-insert – lokeshjain2008