I'm working on a PHP based website and have come across an extremely weird issue that I hoping for some type of guidance for.
Whilst creating a sign up page, I've added in all the relevant coding but when adding a test account into the form, I am given this particular error that I seem unable to fix.
"Parse error: syntax error, unexpected end of file in E:\webareas\wo1742o\ucwe_cw\process.php on line 31"
Could anyone possibly provide some clarity as to why this error keeps popping up?
Here's the code used for 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";
}
?>
You are missing a closing curly bracket for the if statement at the start of the file. Add a
}
before the?>
at the end of the file.