0
我試圖將一些數據保存到我的表gal_photographers
。雖然我的表結構是:var_dump()cakephp中的save()函數不顯示所有字段
CREATE TABLE IF NOT EXISTS `gal_photographers` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`gal_provider_id` int(4) NOT NULL,
`starting_month` varchar(2) NOT NULL DEFAULT '01',
`starting_year` varchar(4) NOT NULL DEFAULT '2010',
`starting_package_wedding` int(7) NOT NULL,
`starting_package_prewedding` int(7) NOT NULL,
`starting_package_studio` int(7) NOT NULL,
`willing_to_travel` tinyint(1) NOT NULL DEFAULT '0',
`candid_photography` tinyint(1) NOT NULL DEFAULT '0',
`traditional_photography` tinyint(1) NOT NULL DEFAULT '0',
`pre-wedding` tinyint(1) NOT NULL DEFAULT '0',
`portraiture` tinyint(1) NOT NULL DEFAULT '0',
`portfolios` tinyint(1) NOT NULL DEFAULT '0',
`location_shoots` tinyint(1) NOT NULL DEFAULT '0',
`videography` tinyint(1) NOT NULL DEFAULT '0',
`awards1` varchar(100) NOT NULL,
`awards2` varchar(100) NOT NULL,
`awards3` varchar(100) NOT NULL,
`video_title1` varchar(150) NOT NULL,
`video_link1` varchar(150) NOT NULL,
`video_title2` varchar(150) NOT NULL,
`video_link2` varchar(150) NOT NULL,
`video_title3` varchar(150) NOT NULL,
`video_link3` varchar(150) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=455 ;
,我試圖以保存:
$sv = $this->GalPhotographer->save();
var_dump($sv);
if($sv) {
echo 'SUCCESS';
}else{ echo 'NO SUCCESS !';
}
但上面save()
不是插入的所有數據。此外,該var_dump($sv)
顯示:
array (size=1)
'GalPhotographer' =>
array (size=10)
'starting_month' => string '01' (length=2)
'starting_year' => string '2010' (length=4)
'willing_to_travel' => string '0' (length=1)
'candid_photography' => string '0' (length=1)
'traditional_photography' => string '0' (length=1)
'pre-wedding' => string '0' (length=1)
'portraiture' => string '0' (length=1)
'portfolios' => string '0' (length=1)
'location_shoots' => string '0' (length=1)
'videography' => string '0' (length=1)
當然,雖然我所有的數據都沒有插入我得到一個消息SUCCESS
!
這些值是什麼? – Anubhav
模型如何?你有場驗證? – cornelb