When connecting to MS SQL, I think it is not right to try mssql_num_rows() or mssql_free_result() on a DELETE Query. Because there is nothing to return.
$db = mssql_connect('server','user','password') or die('No Connection');
mssql_select_db('database',$db);
$rs2 = mssql_query('DELETE from table',$db);
$p = mssql_num_rows($rs2);
mssql_free_result($rs2);
You might receive a warning like:
Warning: mssql_num_rows(): supplied argument is not a valid MS SQL-result resource
mssql_num_rows
(PHP 4, PHP 5, PECL odbtp:1.1.1-1.1.4)
mssql_num_rows — Gets the number of rows in result
Описание
int mssql_num_rows
( resource $result
)
mssql_num_rows() returns the number of rows in a result set.
Список параметров
- result
-
The result resource that is being evaluated. This result comes from a call to mssql_query().
Возвращаемые значения
Returns the number of rows, as an integer.
mssql_num_rows
jose_dandrade at yahoo dot com
15-Dec-2006 07:45
15-Dec-2006 07:45
h dot schuemann at cyquest-ag dot de
13-Nov-2000 10:13
13-Nov-2000 10:13
For getting something like "mssql_affected_rows" call:
<?php
$rsRows = mssql_query("select @@rowcount as rows", $db);
$rows = mssql_result($rsRows, 0, "rows");
?>
after execution of the query (UPDATE, INSERT or DELETE).
