开发者

General error: 1364 Field 'created' doesn't have a default value' in \lib\Zend\Db\Statement\Pdo.php:238

开发者 https://www.devze.com 2023-02-08 23:56 出处:网络
Hi i am using zend framework and doing one login example with database...i am getting the page which i ne开发者_Go百科ed to fill the form after click the submit button getting this error..

Hi i am using zend framework and doing one login example with database...i am getting the page which i ne开发者_Go百科ed to fill the form after click the submit button getting this error..

 exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[HY000]: General error: 1364 Field 'created' doesn't have a default value' in C:\Program Files\Zend\Apache2\htdocs\zend_sample\lib\Zend\Db\Statement\Pdo.php:238
Stack trace:
#0 C:\Program Files\Zend\Apache2\htdocs\zend_sample\lib\Zend\Db\Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array)
#1 C:\Program Files\Zend\Apache2\htdocs\zend_sample\lib\Zend\Db\Adapter\Abstract.php(464): Zend_Db_Statement->execute(Array)
#2 C:\Program Files\Zend\Apache2\htdocs\zend_sample\lib\Zend\Db\Adapter\Pdo\Abstract.php(232): Zend_Db_Adapter_Abstract->query('INSERT INTO `re...', Array)
#3 C:\Program Files\Zend\Apache2\htdocs\zend_sample\lib\Zend\Db\Adapter\Abstract.php(542): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `re...', Array)
#4 C:\Program Files\Zend\Apache2\htdocs\zend_sample\app\controllers\IndexController.php(47): Zend_Db_Adapter_Abstract->insert('register', Array)
#5 C:\Program Files\Zend\Apache2\htdocs\zend_sample\lib\Zend\Controller\Action.php(512): IndexController->indexAction()
#6 C:\Program Files\Zend\Apache2\htdocs\zend_sample\lib\Zend\Controller\Dispatcher\Standard.php(288): Zend_Controller_Action->dispatch('indexAction')
#7 C:\Program Files\Zend\Apache2\htdocs\zend_sample\lib\Zend\Controller\Front.php(945): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#8 C:\Program Files\Zend\Apache2\htdocs\zend_sample\www\index.php(37): Zend_Controller_Front->dispatch()
#9 {main}

Please help me.....


Two solutions to choose from:

  1. Change the code that processes this form to set a value for the created field on the object you're persisting.

  2. Change the schema to define a default value for the created column in the database. CURRENT_TIMESTAMP is a valid default to automatically set the column to the current time when a row is inserted.

0

精彩评论

暂无评论...
验证码 换一张
取 消