georgeyang 2012-07-21 15:07:15 9121次浏览 9条回复 0 0 0

小弟创建一个tbl_project表 数据库名字叫trackstar_dev 使用GII完成了创建模型和视图。 进入http://localhost/trackstar/index.php?r=project 也没问题。可以浏览自己在数据库里输入的表数据。 但是在创建project时就会出错,输入数据后显示的是CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '' for column 'create_time' at row 1. The SQL statement executed was: INSERT INTO `tbl_project` (`name`, `description`, `create_time`, `create_user_id`, `update_time`, `update_user_id`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5) 

求教各位大哥大姐,如何解决

  • 回复于 2012-07-21 16:17 举报

    你把数据库字段的类型和POST接收到的数据贴出来吧。

  • 回复于 2012-07-21 16:19 举报

    我就是不知道怎么显示POST接收到的数据类型,所以才问的

  • 回复于 2012-07-21 16:22 举报

    print_r($_POST) 或 var_dump($_POST)

  • 回复于 2012-07-21 16:29 举报

    麻烦您给我说全了吧 写在哪个文件的哪个位置,我实在闹不懂了

  • 回复于 2012-07-22 10:11 举报

    create_time字段约束有问题。

  • 回复于 2012-09-21 10:56 举报

    我也遇到了这样的问题,真是很奇怪啊~ 菜菜们伤不起~

  • 回复于 2012-09-21 10:58 举报

    这个字段约束在哪里呢?我直接用gii 生成一个model,再生成一个Crud 然后就执行create 就出现了这样的问题

  • 回复于 2012-09-21 11:23 举报
    CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '' for column 'update_time' at row 1. The SQL statement executed was: INSERT INTO `yii_computer_user` (`username`, `password`, `realname`, `tel`, `sex`, `class_id`, `status_id`, `create_time`, `update_time`, `create_user_id`, `update_user_id`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10). Bound with :yp0='weizhi', :yp1='d41d8cd98f00b204e9800998ecf8427e', :yp2='', :yp3='', :yp4='1', :yp5='1', :yp6=1, :yp7='2011-04-27 22:01:33', :yp8='', :yp9='', :yp10='' [/code]我也遇到了这样的问题,唉~ 实在是找不到原因啊,求救 求救~
    我安装的是BoyLee给的那个表,我看他视频都没有问题,我这里怎么就这么大的问题呢? 我按照操作提示 打开了Application Log 下面给的提示是:[code]Executing SQL: INSERT INTO `yii_computer_user` (`username`, `password`,
    `realname`, `tel`, `sex`, `class_id`, `status_id`, `create_time`,
    `update_time`, `create_user_id`, `update_user_id`) VALUES (:yp0, :yp1,
    :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10). Bound with
    :yp0='weizhi', :yp1='d41d8cd98f00b204e9800998ecf8427e', :yp2='', :yp3='',
    :yp4='1', :yp5='1', :yp6=1, :yp7='2011-04-27 22:01:33', :yp8='', :yp9='',
    :yp10=''
    in
    D:\DevEnv\KDNLTP\webapp\yii_go_part2\protected\controllers\UserController.php
    (72)
    in D:\DevEnv\KDNLTP\webapp\yii_go_part2\index.php (13)
    

    不知道怎么搞,数据库也来回导了两次了,模型也重建了~ 还是不行 求助 求助~

  • 回复于 2012-09-21 12:35 举报

    提示的都是说不正确的时间格式,你们把给时间赋值的语句拿出来看看。

您需要登录后才可以回复。登录 | 立即注册