把括号里的!去掉试试  if ($db)

解决方案 »

  1.   

    把括号里的!去掉试试  if ($db)
      

  2.   

    改成这样行么?
    if($result = mssql_query($query))
      echo  mssql_affected_rows()." 数据添加成功。";
      

  3.   

    另外,影响行数的函数原型是这样吧
    int mssql_rows_affected ( int conn_id)你的少了参数
      

  4.   

    上面的方法我都试过了,不成啊!mssql_rows_affected () 的参数应该是可以省略的!
      

  5.   

    julstunt at yahoo.fr
    14-Jan-2005 02:22 
    Warning ! with php 4.3.10, when you use mssql_query to insert or update data, the returned result is false but the query is really executed.
    So you don't know if the query was really executed or not :/ 不要判断,没用的
      

  6.   

    [17 Jan 10:57pm CET] [email protected] 
    This bug has been fixed in CVS.Snapshots of the sources are packaged every three hours; this change
    will be in the next snapshot. You can grab the snapshot at
    http://snaps.php.net/.
      

  7.   

    楼上的兄弟,你的方案似乎解决了部分问题!但是 mysql_affected_rows() 还是没有返回数值,似乎它被忽略了!继续执行其它语句了!
      

  8.   

    这样:
    if(mssql_query($query))
    {
      ...
    }//因为如果不是选择数据,就不会有数据集的,所以你的程序中$result始终为false,当然不执行了~