Yii Framework Forum: Adding New Users - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Adding New Users

#1 User is offline   sgmartin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 02-October 13

Posted 07 October 2013 - 02:24 PM

I'm seeing the same issue when adding new users to the tblusers table that I saw adding new projects to the tbl_project table. The datetime fields don't get added with Null values. This is the error:

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1292 Incorrect datetime value: '' for column 'last_login_time' at row 1. The SQL statement executed was: INSERT INTO `tbl_user` (`username`, `email`, `password`, `last_login_time`, `create_time`, `create_user_id`, `update_time`, `update_user_id`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7)

The default value in the table is set to NULL.
0

#2 User is offline   nineinchnick 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 622
  • Joined: 12-September 11
  • Location:Bialystok, Poland

Posted 08 October 2013 - 10:31 AM

Try to set them to current timestamp, for example in the beforeSave method of your active record.
Don't be a dick.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users