PHP: mssql_num_rows - Manual

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, 26 Jan 2007

view this page in

# mssql_num_rows

(PHP 3, PHP 4, PHP 5)

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.

See also mssql_query() and mssql_fetch_row().

add a note User Contributed Notes
mssql_num_rows
jose_dandrade at yahoo dot com
15-Dec-2006 07: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 10: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).`
add a note
mssql_pconnect mssql_num_fields

Last updated: Fri, 26 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 10:36:09 2007 PST