444683462
V2EX  ›  问与答

thinkphp 用 create 更新数据无效

  •  
  •   444683462 · Mar 17, 2015 · 1929 views
    This topic created in 4085 days ago, the information mentioned may be changed or developed.

    //修改的部分
    if(I('post.id')){
    $Department=D('Department');
    if (!$Department->create($_POST,2)){ // 创建数据对象
    $this->error($Department->getError());
    }else{
    $result=$Department->save();

    if(false !== $result){
                    $id = I('post.id');
                    $this->redirect('updateDepartment',array('update'=>"1",'id' =>"$id"));
                }else{
                    $this->error("数据修改失败");
                }
            }
    
        }
    
    1 replies    2015-03-17 10:20:13 +08:00
    zts1993
        1
    zts1993  
       Mar 17, 2015
    输出一下$Department->getlastsql();
    看下sql语句是否正确
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2598 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 15:41 · PVG 23:41 · LAX 08:41 · JFK 11:41
    ♥ Do have faith in what you're doing.