Im getting an error on line 4, The curly bracket. From what i know the bracket needs to be there. How can i fix this ?
<?php
include('config.php');
// for the registration script we need a html form
if($_SERVER['REQUEST_METHOD'] == 'POST' {
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string(md5($_POST['password']));
//retrieve the input from the user and encrypt the password with md5
} if(empty($username)) {
echo("Please enter a Username");
} else {
if(empty($password)) {
echo("Please enter a password");
} else {
//check if username already exists
$query = mysql_query("SELECT * FROM users WHERE username='$username'");
$rows = mysql_num_rows($query);
//with mysql_query you call a sql command
if($rows > 0) {
die("Username taken !!");
} else {
$user_input = mysql_query("INSERT INTO users (username , password) VALUES ('$username' , '$password')");
echo("Successfully Registered ");
}
}
}
?>