我已经编写并运行了以下脚本:
<?php
session_start();
include("dbconfig.php");
if(isset($_POST['submit'])){
$username = $_POST['username'];
$pass = $_POST['password'];
if(empty($username) or empty($pass)){
echo 'Please complete the required fields' ;
}
elseif(!empty($username) and !empty($pass)){
$sql = mysql_query("select username, password from users where username = '$username' and password = '$pass'");
if(($sql) == 0){
echo 'This user does not exist!';
}
elseif(($sql) == 1){
echo 'This user does exist!';
}
}
}
我收到了这个错误:
Line : 41, Error type : 4
Message : syntax error, unexpected '<'
我尝试尽可能多地编辑代码..下面是dbconfig文件!
<?php
$host = 'localhost';
$user = 'root';
$pass = ''
$db = 'document management system';
if(!mysql_connect($host, $user, $pass) || !mysql_select_db($db)){
die(mysql_error);
}
?>
我没有看到配置文件有任何问题..但我把它放在那里以防万一!
答案 0 :(得分:1)
您需要在$pass
的{{1}}末尾添加分号
dbconfig.php