我有以下代码:
$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);
这里我使用as:
获取$ dateStart和$ dateEnd变量$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 :(得分:0)
replace $dateStart='"'.$dateStartt.'"';
与
$dateStart= $dateStartt ;
或
$dateStart='`'.$dateStartt.'`';