2012-04-24 84 views
0

我有FOLL代碼:插入日期到數據庫表使用Zend框架的插入方法

$table_project_win = new Application_Model_DbTable_AfterWinProject(); 

    $data_win = array(
       'project_id' => $project_id, 
       'project_name' => $project, 
       'project_type_id' => $pro_type, 
       'start_date' => $dateStart, 
       'end_date' => $dateEnd, 
       'project_size' => $size, 
       'project_description' => $pro_des 
    ); 

    $table_project_win->insert($data_win); 

在這裏,我得到了$ dateStart和$ dateEnd variabled使用爲:

$dateStartt = $this->_getParam('dateStart'); 
echo 'date Start: '.$dateStartt; 
$dateStart='"'.$dateStartt.'"'; 
$dateEndd = $this->_getParam('dateEnd'); 
$dateEnd='"'.$dateEndd.'"' 

通過使用getParam我得到用戶輸入日期的值但是當我將其插入到數據庫中時,我將其用作

$dateStart='"'.$dateStartt.'"'; 
$dateEnd='"'.$dateEndd.'"' 

但是在數據庫表中插入日期的值是'0000-00-00'而當我回顯我通過getParam得到的$ dateStart它給出正確的值爲'2012-12-11'。什麼原因它是什麼?我該怎麼辦?

回答

0
replace $dateStart='"'.$dateStartt.'"'; 

$dateStart= $dateStartt ; 

$dateStart='`'.$dateStartt.'`';