这是我的用户表结构:
+----------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------------+------+-----+---------+----------------+
| ID | int(10) unsigned | NO | PRI | NULL | auto_increment |
| screen_name | varchar(20) | NO | UNI | NULL | |
| slug | varchar(20) | NO | | NULL | |
| email | varchar(50) | NO | UNI | NULL | |
| pass | varchar(32) | YES | | NULL | |
| signin_twitter | enum('T','F') | NO | | F | |
| twitter_id | int(11) | YES | UNI | NULL | |
| bg_image | varchar(50) | YES | | NULL | |
+----------------+------------------+------+-----+---------+----------------+
我正在尝试将数据添加到我的数据库中。(在我的控制器中)
$model=new Users;
//$this->performAjaxValidation($model);
if(isset($_POST['Users']))
{
//screen_name, email,pass comes from form. Also, we need to set **slug** and **singin_twitter**
$_POST['Users']['slug'] = $this->sanitize($_POST['Users']['screen_name']);
$_POST['Users']['signin_twitter'] = 'F';
$model->attributes=$_POST['Users'];
if($model->save())
$this->redirect('dash/index');
}
但它不保存数据。$model->save() returning FALSE
. 我该如何调试它?