|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18928 mssql_num_rows() doesn't work
Submitted: 2002-08-15 17:40 UTC Modified: 2002-09-21 01:54 UTC
Avg. Score:3.8 ± 1.5
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:2 (50.0%)
From: matthius at u dot washington dot edu Assigned:
Status: No Feedback Package: MSSQL related
PHP Version: 4.2.2 OS: Win2k Server
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-08-15 17:40 UTC] matthius at u dot washington dot edu
Using MSSQL 2000

The function mssql_num_rows generates the following 

Warning: mssql_num_rows(): supplied argument is not a valid 
MS SQL-result resource

At the advice of the documentation I tried making the 
following query:

			$query2 = 'SELECT @@ROWCOUNT';

			$result2 = mssql_query($query2);

			list($affected) = mssql_fetch_row($result2);


This generates the following error:

Warning: MS SQL: Query failed

All other queries work fine I can interact with the 
database. I have also tried the latest stable build on as of today 8-15-02 the problem remains 

Any help would be greatly appreciated.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-15 18:24 UTC]
I'm not a MSSQL user, so I don't know the specifics of that query string.  But if the query fails, of course you'll receive this error message from MSSQL.... the result set isn't populated, thus there is nothing to retrieve. 

Unless you can show this error message to work with a valid SQL query, I'm going to mark this as Bogus.  If you can, you're welcome to re-open the bug and add this new information. 
 [2002-08-15 19:18 UTC] matthius at u dot washington dot edu
Sorry for not including that detail. Please let me clarify, 
the actuall query IS valid and it does succeed. It affects 
about 3300 rows. I am pasting my code snippet:

// above is DB connection stuff, all goes well

	$query = '	DECLARE @Ident int
				INSERT INTO LastMod (lastModBy, lastModDate)
				VALUES ("Matt - Email Import Test", GETDATE())
				SET @Ident = @@IDENTITY
				-- insert primary email
				INSERT INTO EmailAdd (personID, address, emailAddType, 
				SELECT newID, Col017, "primary", @Ident 
				FROM fmFullExport	
				WHERE Col017 != ""	AND Col002 LIKE "%_%" AND COL003 
LIKE "%_%"
	// execute query
	$result = mssql_query($query);	
// it dies on that last line

This is the error message it generates:

Warning: mssql_num_rows(): supplied argument is not a valid 
MS SQL-result resource in 
c:\inetpub\wwwroot\DBclass\index.php on line 36
 [2002-08-15 19:41 UTC]
does this happen with a very simple SELECT query, that returns one row?
 [2002-09-21 01:54 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 06:01:31 2024 UTC