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

Link to comment
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/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.