Ads Inside Post

Search in This Blog

PHP with MSSQL Server Simple Query

PHP with MSSQL Server Simple Query.

<?php
session_start();
$sqlServerIP = '127.0.0.1';
$link = mssql_connect($sqlServerIP, 'sa', 'amit123');
if (!$link) {
    die('Wrong connection');
}

mssql_select_db('AssetMgmt', $link);
$User_Email="email@email.com";
$User_Pass='test';
$ssql="select *from USER_MASTER where User_Email='".$User_Email."' and User_Pass='" .$User_Pass ."'";
$result = mssql_query($ssql);
$numrow=mssql_num_rows($result);
if (!mssql_num_rows($result)) {
    echo 'Login/Pass is invalid';
}
else
{
    echo '<ul>';
    while ($row = mssql_fetch_assoc($result)) {
        echo '<li>' . $row['Name'] . ' (' . $row['EmpID'] . ')</li>';
    }
    echo '</ul>';
}
mssql_free_result($result);
?>