+ -
当前位置:首页 → 问答吧 → thinkphp无法添加数据到数据库

thinkphp无法添加数据到数据库

时间:2011-06-21

来源:互联网


public function add()
  {
      Load('extend');
      if($_POST['password'] != $_POST['repassword'])
      {
          $this->success('两次密码不一致');
      }
      $user = M('User');
     // $user->password = md5($user->password);
     // $user->createtime = time();
     // $user->createip = get_client_ip();


      if($vo = $user->create())
      {
          dump($user);
          $list = $user->add();
          
          if($list !== false)
          {
              $this->success('创建用户成功');
          }else{
              $this->error('创建用户失败');
          }


      }else{
          $this->error($user->getError());


      }
  }


数据库字段:ID,username,password,createtime,createid
表单:3个输入框,username,password,repassword
无法把数据添加到数据库

作者: cherbimel   发布时间: 2011-06-21

dump后显示的是什么

作者: er_shi   发布时间: 2011-06-21