For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Thursday, August 14, 2014

PHP with MSSQL Server Stored Procedure

Here is the code to connect PHP with Mssql Server Stored procedure.



<?php
$sqlServerIP = '127.0.0.1';
$link = mssql_connect($sqlServerIP, 'sa', 'amit123');
if (!$link) {
    die('wrong connection.');
}
mssql_select_db('amittest', $link);
$stmt = mssql_init('LoginChk');
$ID = 1;
$EmpID = 'Emp001';
$OutputLogin=0;
// Bind values
mssql_bind($stmt, '@ID',            $ID,              SQLINT4,     false, false, 60);
mssql_bind($stmt, '@EmpID',         $EmpID,           SQLVARCHAR,  false, false, 20);
mssql_bind($stmt, '@OutputLogin',     $OutputLogin,   SQLINT4,     true,  false, 20);
mssql_execute($stmt);
mssql_free_statement($stmt);
echo $OutputLogin;
echo mssql_get_last_message();
/*
////////////////////////////////////////////////////////
CREATE PROCEDURE dbo.LoginChk
    @ID varchar(50),
    @EmpID varchar(50),
    @OutputLogin bigint OUTPUT
    as
begin
    IF(EXISTS(select ID,EmpID, from Employee where ID=@ID and EmpID=@EmpID))
        begin
            --select  @OutputFirstName=vFirstName from AdminInfo where vUserId=@UserId and vPassword=@Password
            select @OutputLogin =1
        End
    else
        begin
            select @OutputLogin =0
        End
End
*/
?>
Share:

0 comments:

Post a Comment

How to make center align child div

 How to make center align child div?   Suppose you have 2 Div tag. And want the make inner tag center <div id="d1">      ...

Ads Inside Post

Powered by Blogger.

Arsip