php.net |  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
Votes:5
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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: matthius at u dot washington dot edu
New email:
PHP Version: OS:

 

 [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: 

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);

			echo($affected);

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 
snaps.php.net as of today 8-15-02 the problem remains 
unchanged.

Any help would be greatly appreciated.

Thanks!
Matt


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-15 18:24 UTC] kalowsky@php.net
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, 
lastModID) 
				SELECT newID, Col017, "primary", @Ident 
				FROM fmFullExport	
				WHERE Col017 != ""	AND Col002 LIKE "%_%" AND COL003 
LIKE "%_%"
										
			 ';				
				
	// execute query
	$result = mssql_query($query);	
	mssql_num_rows($result);
	
// 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] kalowsky@php.net
does this happen with a very simple SELECT query, that returns one row?
 [2002-09-21 01:54 UTC] sniper@php.net
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: Sun Nov 03 19:01:28 2024 UTC