1.文档中有mssql_rows_affected这个函数,不知道好时不好使
2.update完了执行 select @@ROWCOUNT
3.update之前先select看看

解决方案 »

  1.   

    PEAR_DB中关于获取影响记录数的操作,大致就是这个样子,没有测试过.    function affectedRows()
        {
            if ($this->_last_query_manip) {
                $res = @mssql_query('select @@rowcount', $this->connection);
                if (!$res) {
                    return $this->mssqlRaiseError();
                }
                $ar = @mssql_fetch_row($res);
                if (!$ar) {
                    $result = 0;
                } else {
                    @mssql_free_result($res);
                    $result = $ar[0];
                }
            } else {
                $result = 0;
            }
            return $result;
        }
      

  2.   

    恩 问题解决 
                                         $que = "UPDATE USER_INFO
        SET name = '".$name."'
          ,[tel] = '".$tel."'
          ,[mail] = '".$mail."'
          ,[uptime] = getDate()
    WHERE name = '".$name."' 
     IF @@ROWCOUNT = 0 
      INSERT INTO USER_INFO
               ([name] ,[tel],[mail],[uptime])
         VALUES
               ('".$name."','".$tel."','".$mail."',getDate())  ";最后用sql文实现的