PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

mssql_pconnect> <mssql_num_fields
Last updated: Fri, 27 Jun 2008

view this page in

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

Description

int mssql_num_rows ( resource $result )

mssql_num_rows() returns the number of rows in a result set.

Parameters

result

The result resource that is being evaluated. This result comes from a call to mssql_query().

Return Values

Returns the number of rows, as an integer.



add a note add a note User Contributed Notes
mssql_num_rows
jose_dandrade at yahoo dot com
15-Dec-2006 03:45
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
h dot schuemann at cyquest-ag dot de
13-Nov-2000 06:13
For getting something like "mssql_affected_rows" call:

$rsRows = mssql_query("select @@rowcount as rows", $db);
$rows = mssql_result($rsRows, 0, "rows");

after execution of the query (UPDATE, INSERT or DELETE).

mssql_pconnect> <mssql_num_fields
Last updated: Fri, 27 Jun 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites