将MySql代码转换为SQLSRV代码

时间:2016-06-29 13:49:52

标签: php sqlsrv

早上好,

检查此代码是否转换良好, 首先是MySQLCode

$statement = mysqli_prepare($con, "SELECT * FROM user WHERE username = ? AND password = ?");

mysqli_stmt_bind_param($statement, "ss", $username, $password);
mysqli_stmt_execute($statement); 
mysqli_stmt_store_result($statement);
mysqli_stmt_bind_result($statement, $userID, $name, $age, $username, $password);

这是SQLSRV:

$sql = "SELECT * FROM dbo.[user] WHERE username = $username and password = $password"; 
$stmt = sqlsrv_prepare($conn, $sql, $params);
if($stmt === false){
die( print_r( sqlsrv_errors(), true));
}

有人可以帮我这个代码吗? PLS。

0 个答案:

没有答案