if(isset($_GET['action'])&&isset($_GET['active'])&&$_GET['action']=='ok'){
            $_active=_mysql_string($_GET['active']);
            if(_fetch_array("select tg_active from tg_user where tg_active='$_active' limit 1")){
                //将tg_active设置为空
                _query("update tg_user set tg_active=null where tg_active='$_active' limit 1");
               if(_affected_rows()==1){
                   mysql_close();
                   _location('账号激活成功', 'login.php');
               }else{
                   mysql_close();
                   _location('账号激活失败', 'register.php');
               }
            }else{
                _location('账号激活失败', 'register.php');
            }
        }
参数没问题

解决方案 »

  1.   


    _location('账号激活失败', 'register.php');但是数据库里还是被update了
      

  2.   

    如果有已被激活,再次激活时就不会发生实际的修改,于是 _affected_rows() 就为 0
      

  3.   

     你2个else 都是 提示 账号激活失败 也不知道你是哪个被执行了.
     最好在测试阶段 可以多加个数字.看看是怎么执行. 账号激活失败1  账号激活失败2 执行IF 就肯定不会执行ELSE. 也许是你的字面提示 迷乱了你吧
      

  4.   


       if(isset($_GET['action'])&&isset($_GET['active'])&&$_GET['action']=='ok'){
                $_active=_mysql_string($_GET['active']);
                if(_fetch_array("select tg_active from tg_user where tg_active='$_active' limit 1")){
                    //将tg_active设置为空
                    _query("update tg_user set tg_active=null where tg_active='$_active' limit 1");
                  
                }else{
                    _location('账号激活失败', 'register.php');
                }
            }结果还是激活失败 ,但是数据库中的数据已经更新
      

  5.   

    var_dump(_fetch_array("select tg_active from tg_user where tg_active='$_active' limit 1"));
      

  6.   

    _affected_rows()的代码贴出来