Jump to content

MSSQL Stored Procedure problem


Sudantha

Recommended Posts

Guys i need to get the return value from this code how to do it ?  :confused:

 


CREATE PROC getLogin @username varchar(50),@password varchar(50)
AS



if exists (SELECT * FROM Operator WHERE Call_ID=@username AND PASSWORD=@password)
BEGIN

return 1
END	

else

return 0


 

 

 

MY php code is following


$stmt=mssql_init('getLogin',$connection);
mssql_bind($stmt,"@username",&$uid,SQLVARCHAR,false,true,60);    
mssql_bind($stmt,"@password",&$password,SQLVARCHAR,false,true,60); 
$result=mssql_execute($stmt);

$arr=mssql_fetch_row($result); 


 

Link to comment
https://forums.phpfreaks.com/topic/202568-mssql-stored-procedure-problem/
Share on other sites

Try like this

 

CREATE PROC getLogin @username varchar(50),@password varchar(50)
AS

SET @user = (SELECT * FROM Operator WHERE Call_ID=@username AND PASSWORD=@password)

if exists (@user)
BEGIN

   RETURN @user
END   

else

return 0

 

thanks rapa ! :D ,, i got a solution but donno is this the best method :D

http://sudantha.wordpress.com/2010/05/25/running-microsoft-sql-mssql-stored-procedures-in-php/

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.