I have the foll code as:

    $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);

Here I get the $dateStart and $dateEnd variabled using as:

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

By using getParam I get the value of the date that the user has given input But when i will insert it into the database I use as

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

But in the database table the value for date inserted is '0000-00-00' While when I echo the $dateStart which I have got through getParam It gives the correct value as '2012-12-11'.What is the reason of it??What Should I do??

有帮助吗?

解决方案

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

with

$dateStart= $dateStartt ;

or

$dateStart='`'.$dateStartt.'`';
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top