我正在让这段代码在 sql server 上工作,但我不知道该怎么做我收到这样的错误消息:
致命错误: Call to undefined function mssql_connect() in on line 8 Call Stack: 0.0012 353392 1. {main}()login.php:0
这是我出于明显原因更改用户名和密码的代码,
<?php
session_start();
$username = $_POST['txt_username'];
$password = $_POST['txt_password'];
if ($username&&$password){
$connect = mssql_connect("server", "username", "password") or die("No Server Found");
mssql_select_db("database name") or die("No Connection");
$query = mssql_query("SELECT * FROM account WHERE username='$username'");
$numrows = mssql_num_rows($query);
if($numrows !=0){
while ($rows = mssql_fetch_assoc($query)){
$dbusername = $row['username'];
$dbpassword = $row['password'];
}
if ($username == $dbusername && $password == dbpassword) {
echo "Login Successful. <a href='homepage.php'></a>";
$_SESSION['username'] = $dbusername;
} elseif ($username == '' || $password == '') {
die("Please enter a username and password");
} elseif (empty($dbusername)) {
die("This account does not exsist");
} else {
die("Please enter a username and password");
}
}
}?>