mr_mojtaba
01-03-2011, 01:25 PM
Hi Experts.
I am using odbc_connect() method to create a connection to my database. I have a store procedure and i need to use it in my php code. i define and use two parameter in store procedure. Now i dont know how define Input parameter and output parameter when i want to use the store procedure in my php code.
My strore procedure code is like:
LTER PROCEDURE [dbo].[Check_IsUsedUsername]
@username nchar(30),
@IsUsed int output
AS
BEGIN
select @IsUsed = (select count(id) from member where username = @username)
select @IsUsed = @IsUsed + (select count(id) from tempMember where username = @username)
END
And my php code is like:
$conn = odbc_connect("Database","sa","1234");
if(!$conn)
{
die("Error in SQL connection.");
}
//sql command
$sql = "{CALL Check_IsUsedUsername(?,?)}";
//prepare command
$rs = odbc_prepare($conn,$sql);
//data bind param
$username = "irmorteza";
$isused = -1;
//////////// How can define input and output parameter for call stroe procedure??????
$success = odbc_execute($rs);
I am using odbc_connect() method to create a connection to my database. I have a store procedure and i need to use it in my php code. i define and use two parameter in store procedure. Now i dont know how define Input parameter and output parameter when i want to use the store procedure in my php code.
My strore procedure code is like:
LTER PROCEDURE [dbo].[Check_IsUsedUsername]
@username nchar(30),
@IsUsed int output
AS
BEGIN
select @IsUsed = (select count(id) from member where username = @username)
select @IsUsed = @IsUsed + (select count(id) from tempMember where username = @username)
END
And my php code is like:
$conn = odbc_connect("Database","sa","1234");
if(!$conn)
{
die("Error in SQL connection.");
}
//sql command
$sql = "{CALL Check_IsUsedUsername(?,?)}";
//prepare command
$rs = odbc_prepare($conn,$sql);
//data bind param
$username = "irmorteza";
$isused = -1;
//////////// How can define input and output parameter for call stroe procedure??????
$success = odbc_execute($rs);