I am getting the following possible syntax error within my code Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\Wonderland-Market\index.php on line 13
If you all could help me proofread it for any mistakes I have made I would be very grateful. I followed a tutorial from youtube not sure if the guy made these errors or if I did Please review and let me know what you think may cause more errors. ...
<?php
session_start();
$host = "localhost";
$username="root";
$database="wonderland-db";
$message="";
try{
$connection = new PDO("mysql:host=$host; dbname=$database", $username,$password);
$connect->setAttribute(PDO::ERRMODE, PDO::ERRMODE_EXCEPTION);
if(isset($_POST["login"]))
{
if(empty($_POST["username"]) || empty($_POST["password"]))
$message = '<label>ALL field is required</label'>;
else{
$query = "SELECT * FROM users WHERE username = :username AND password = :password";
$statement = $connect->prepare($query);
$statement->execute(
array(
'username' => $_POST["username"]
'password' => $_POST["password"]
)
);
$count =$statement->rowCount();
if($count > 0)
{
$_SESSION["username"] = $_POST["username"];
header(location:"welcome.php");
}
else
{
$message = '<label> Username or Password is wrong </label>'
}
}
}
}
catch(PDOException $error)
{
$message = $error -> getMessage()
}
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Login</title>
<style>
.login{
width:360px;
margin:50px auto;
font:Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", serif;
border-radius:10px;
border:2px solid #ccc;
padding:10px 40px 25px;
margin-top:70px;
}
input[type=text], input[type=password]{
width:99%;
padding:10px;
margin-top:8px;
border:1px solid #ccc;
padding-left:5px;
font-size:16px;
font-family:Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", serif;
}
input[type=submit]{
width:100%;
background-color:#009;
color:#fff;
border:2px solid #06F;
padding:10px;
font-size:20px;
cursor:pointer;
border-radius:5px;
margin-bottom:15px;
}
</style>
</head>
<body>
<div class="login">
<h1 align="center">Login</h1>
<form action="" method="post" style="text-align:center;">
<input type="text" placeholder="Username" id="user" name="user"><br/><br/>
<input type="password" placeholder="Password" id="pass" name="pass"><br/><br/>
<input type="submit" value="Login" name="submit">
<!-- Error Message -->
<span><?php echo $error; ?></span>
</body>
</html>
...