[phplib] mssql_affected_rows does not exist in php From: Mark Burnette (markc <email protected>)
Date: 09/26/00

In db_mssql.inc class DB_Sql has the member function:

  function affected_rows() {
    return mssql_affected_rows($this->Query_ID);
  }

but mssql_affected_rows does not exist. MySQL has mysql_affected_rows and I
believe that other databases do as well but Microsoft SQL Server does not.
phplib calls affected_rows in ct_sql.inc. The sample pages also call
affected_rows but these are technically not part of phplib. For phplib 7.2c
the fix for ct_sql.inc is:

Replace:

# if ( $this->db->affected_rows() == 0
# && $this->db->query($squery)
# && $this->db->f(1) == 0
# && !$this->db->query($iquery)) {

# $ret = false;
# }

With:

    if ( $this->db->query($squery)
        && $this->db->f(1) == 0
        && !$this->db->query($iquery)) {

        $ret = false;
    }

This simply checks to see if there is already a record in the table and if
not it runs the insert query. phplib will generate an error under MS SQL
Server if this fix is not made. Hopefully, they will correct this in future
releases. The same issue occurs in phplib 7.2b with a similar fix.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>