我尝试连接,浏览器没有实现代码,只是显示代码。以下是我的代码。
<?php
$inputuser = $_POST['user'];
$inputpass = $_POST['pass'];
$user = "root";
$password = "";
$database = "tutorial";
$connect = mysql_connect("localhost",$user,$password);
@mysql_select_db($database) or ("Database not found");
$query = "SELECT * FROM 'users' where 'user' = '$inputuser'";
$querypass = "SELECT * FROM 'users' where 'password' = '$inputpass'";
$result = mysql_query($query);
$resultpass = mysql_query($querypass);
$row = mysql_fetch_array($result);
$rowpass = mysql_fetch_array($resultpass);
$serveruser = $row["user"];
$serverpass = $row["password"];
if($serveruser&&$serverpass){
if(!$result){
die("username or password is invalid");
}
echo "<br><center><Database output</br></center><br><br>";
mysql_close();
echo $username;
echo $password;
}
?>