PHP 7.1连接到MSSQL NOT SQLSRV

时间:2017-08-10 01:45:24

标签: sql-server php-7.1

任何人都可以帮助我如何在php 7.1中使用mssql而不是sqlsrv,因为我喜欢尝试使用mssql,因为我是编程新手。

1 个答案:

答案 0 :(得分:-2)

include 'connect.php';
$login_id = $_REQUEST['mobile_number'];
 $user_flag = $_REQUEST['user_flag'];

$con = mysqli_connect($host,$username,$password,$database);
  if (!$con) {    die("could not connect: " . mysqli_connect_error());    
}
$sql =  "select * from login_details WHERE mobile_no = '$login_id' AND user_flag = '$user_flag'";

 $result = mysqli_query($con, $sql) or die("Error in Selecting " .mysqli_error($con));

 while($row =mysqli_fetch_assoc($result)) {
     $emparray[] = $row;
 }
 echo json_encode($emparray);

 mysql_close($con);