Hi,
I'm doing a small project at work with php, ms sql server on w2k IIS5.  
All the data access is done through stored procedures.  This seems to 
be working fine, the record sets are returned and the stored 
procedures execute without error however I can't get any return 
values from them.  
For example I have the following php code:

// setup stored procedure
$sp = mssql_init("spGetReseller", $conObj);
mssql_bind($sp, "@ResellerID", $loginID, SQLINT4, FALSE);
mssql_bind($sp, "@ReturnCode", &$retVal, SQLINT4, TRUE);

$rs = mssql_execute($sp);

So the @ReturnCode variable is defined as OUTPUT in the SP and I am 
passing in $retVal by reference.  This is my stored procedure.

ALTER PROCEDURE spGetReseller
                        @ResellerID int
                        , @ReturnCode int OUTPUT
AS

SELECT Something
FROM SomeTable
WHERE SomeField = 1

-- set return code
IF @@ROWCOUNT > 0
  SET @ReturnCode = 0
ELSE
  SET @ReturnCode = 1

This should set the returncode to be 1 if there are no rows returned.  
However no matter what, it will never get this returncode from the 
stored procedure.  (ie $retVal will not be changed by the mssql_bind 
function)  I ran the stored procedure and the @returnCode variable is 
set correctly there so that isn't the problem.  

Does anyone know what could be the problem there?  I guess I could 
return @ReturnCode in the recordset but that would be kinda hokey.

Thanks,
Leo

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to