V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
444683462
V2EX  ›  问与答

thinkphp 用 create 更新数据无效

  •  
  •   444683462 · 2015-03-17 01:14:18 +08:00 · 1547 次点击
    这是一个创建于 3351 天前的主题,其中的信息可能已经有所发展或是发生改变。

    //修改的部分
    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 条回复    2015-03-17 10:20:13 +08:00
    zts1993
        1
    zts1993  
       2015-03-17 10:20:13 +08:00
    输出一下$Department->getlastsql();
    看下sql语句是否正确
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2363 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 08:38 · PVG 16:38 · LAX 01:38 · JFK 04:38
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.