#28068 [Opn->Asn]: mssql_num_rows() is returning an invalid handle

From: Date: Tue, 20 Apr 2004 07:11:51 +0000
Subject: #28068 [Opn->Asn]: mssql_num_rows() is returning an invalid handle
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-58432@lists.php.net to get a copy of this message
ID: 28068 Updated by: derick@php.net Reported By: oooacooo at yahoo dot com -Status: Open +Status: Assigned Bug Type: MSSQL related Operating System: Windows 2K Server; Apache 2.0.45 PHP Version: 4.3.4 -Assigned To: +Assigned To: fmk New Comment: Assigning to the maintainer, as this is obviously wrong (and BC breaking) behavior. Previous Comments: ------------------------------------------------------------------------ [2004-04-19 22:01:58] oooacooo at yahoo dot com Description: ------------ When using mssql_execute() with PHP version 4.3.2 mssql_num_rows() will return 0, when no records are returned from a stored procedure. When using version 4.3.4 and above mssql_num_rows() will return "supplied argument is not a valid MS SQL-result resource" I tested this by running the code successfully with the php_mssql.dll which ships with 4.3.2 and then swapped php_mssql.dll with the one that ships with 4.3.4 and restarted Apache. Reproduce code: --------------- $validEpisode = mssql_query("spValidateEpisodeDate " . $AccountID . ",'" . $inputVisitDate . "'",$db); if(mssql_num_rows($validEpisode) > 0) { $row = mssql_fetch_object($validEpisode); if($row->Episode_ID == "") $errorMsg = "There is no episode for this account that covers the visit date entered.<br>" . $errorMsg; else $EpisodeID = $row->Episode_ID; } Expected result: ---------------- If no records are found I would expect "if(mssql_num_rows($validEpisode) > 0)" to return true. Actual result: -------------- "if(mssql_num_rows($validEpisode) > 0)" throws an error "supplied argument is not a valid MS SQL-result resource" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28068&edit=1

« previous php.bugs (#58432) next »