444683462
V2EX  ›  问与答

thinkphp 用 create 更新数据无效

  •  
  •   444683462 · Mar 17, 2015 · 2221 views
    This topic created in 4268 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
    zts1993
    Mar 17, 2015
    1
    输出一下$Department->getlastsql();
    看下sql语句是否正确
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1660 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 16:11 · PVG 00:11 · LAX 08:11 · JFK 11:11
    ♥ Do have faith in what you're doing.