我正在研究一个基于PHP的网站,并且遇到了一个非常奇怪的问题,我希望能为某种类型的指导提供。
在创建一个注册页面时,我添加了所有相关编码,但是在将测试帐户添加到表单中时,我被给予了我似乎无法修复的特定错误。
"解析错误:语法错误,e: webareas wo1742o ucwe_cw ucwe_cw process.php on 31"
任何人都可以说明为什么此错误不断弹出?
这是用于SQL Connection
的代码<?php
if(!empty($_POST['username']) && !empty($_POST['userpassword'])) {
require 'sqlData.php';
// Database Connection
$link = mysqli_connect($host, $username, $password, $dbname) or die('Failed to connect to MySQL server. ' . mysqli_connect_error($link));
$username = stripslashes($username);
$password = stripcslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
// get values from form in login.php file
$username = $_POST['username'];
$password = $POST['passname'];
$query = "SELECT id, username, passwod FROM users WHERE username =
'$username' AND password = '$password'";
// Query the database for user
$result = mysql_query("select * from users where username = '$username' and password = '$password'") or die('Failed to query database'.mysql_error());
//output data
$row = mysql_query($result);
if ($row['username'] == $username && $row['password'] == $password) {
echo "Login success! Welcome".$row['username'];
} else {
echo "Failed to login";
}
?>
您缺少文件开始时的if语句的结尾卷曲括号。在文件末尾的?>
之前添加}
。