I don't know if this will fix it, but why don't you trying wraping your while in a num rows call? Like: if(mssql_num_rows($result) > 0) { while($row = mssql_fetch_array($result)) { echo $row[whatever]; } } Adam Voigt adam.voigt@cryptocomm.com On Tue, 2002-10-22 at 11:49, Hien Nguyen wrote: > I am using a MSSQL stored procedure that is a select > on a table. It works fine in an ASP app. And in Query > Analyzer. > > However, in PHP it works fine unless the select > returns zero rows. When 0 rows are returned I get an > invalid result source. > > In the sample code below I will get an error when I > fetch the row because the result source that is > returned from the stored procedure is invalid, but > only when the result set is empty. > > $stmt=mssql_init("spMyProc"); > mssql_bind($stmt,"@param1",$var1,SQLINT4,false,false,4); > mssql_bind($stmt,"@param2",$var2,SQLINT4,false,false,4);$result > $result = mssql_execute($stmt); > > while ($row=mssql_fetch_array($result)) { > } > > I would appreciate any help or leads. Thank you. > > Hien Nguyen > Rutgers Campus Information Services > hqnguyen77@yahoo.com > > > __________________________________________________ > Do you Yahoo!? > Y! Web Hosting - Let the expert host your web site > http://webhosting.yahoo.com/ > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php