我刚开始学习如何在网站中实现数据库,因此一直在尝试在我自己的网站上添加登录功能。但是,当按下提交登录时,我收到错误:解析错误:语法错误,意外' $结果'第13行的/opt/lampp/htdocs/login/process.php中的(T_VARIABLE)。
以下是我的processing.php文件的代码:
<?php
$username = $_POST['username'];
$password = $_POST['password'];
$username = stripcslashes($username);
$password = stripcslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
mysql_connect("localhost", "root", "");
mysql_select_db("login")
$result = mysql_query("select * from users where username = '$username' and password = '$password'")
or die("Failed to query database ".mysql_error());
$row = mysql_fetch_array($result);
if($row['username'] == $username && $row['password'] == $password && ("" !== $username || "" !== $password)) {
echo "Login Success! Welcome, ".$row['username'];
} else {
echo "Failed to Login!";
}
?>
感谢任何帮助。
答案 0 :(得分:-1)
您错过了下一行末尾的半列
rpmbuild -ba ~/rpmbuild/SPECS/httpd.spec
应用半列将解决问题。