1
我有一個CakePHP的應用程序,我需要插入一些數據到表中。我遵循CakePHP書中的教程,但它不起作用。保存數據到一個新行
$this->Temporary->create();
$this->Temporary->set(
array(
'Temporary.position_id'=>$employeesAttribute[$arrCount][0]['EmployeeAttribute']['position_id'],
'Temporary.person_id'=>$employeesAttribute[$arrCount][0]['StatusEmployee']['person_id'],
'Temporary.job_id'=>$employeesAttribute[$arrCount][0]['Job']['id'],
'Temporary.unit_id'=>$employeesAttribute[$arrCount][0]['Unit']['id'],
'Temporary.person_code'=>$employeesAttribute[$arrCount][0]['StatusEmployee']['code'],
'Temporary.name'=>$employeesAttribute[$arrCount][0]['Person']['first_name'].' '.$employeesAttribute[$arrCount][0]['Person']['middle_name'].' '.$employeesAttribute[$arrCount][0]['Person']['last_name'],
'Temporary.job'=>$employeesAttribute[$arrCount][0]['Job']['short_desc']
)
);
$this->Temporary->save();
我用create()
方法,設置變量和調用保存方法,但這些代碼不會將數據保存到我的餐桌。這段代碼有什麼問題?
嘗試'var_dump($ this-> Temporary-> invalidFields());'保存後。 – deceze 2012-04-23 10:06:36
結果仍然相同,它不會將數據保存到表格..但感謝您的回答。 – user1290932 2012-04-23 10:10:07
這只是應該幫助你*調試* ... – deceze 2012-04-23 10:28:37