Right ive updated my coding which is now -
<?php
require_once("db/connect.php");
session_start();
//Declare Variables
$Username = $_POST['username'];
$Email = $_POST['email'];
$Email1 = "@";
$Email_Check = strpos($Email,$Email1);
$Password = sha1($_POST['password']);
$Re_Password = sha1($_POST['re-password']);
//Check To See If All Information Is Correct
if($Email == "")
{ die("You have not entered your email!"); }
if($Email_Check === false)
{ die("Your email is incorrect!"); }
//Check to see if the email address is already in use
$email_add = mysql_query("SELECT * FROM users WHERE email='$email_add'");
if (mysql_num_rows($email_add) > 0)
{ die("That email is already in use"); }
if($Username == "")
{ die("You didn't enter a username!"); }
//Check to see if the username is already in use
$user = mysql_query("SELECT * FROM users WHERE username='$username'");
if (mysql_num_rows($user) > 0)
{ die("That username is already taken"); }
if($Password == "" || $Re_Password == "")
{ die("You didn't enter a password!"); }
if($Password != $Re_Password)
{ die("Your passwords don't match!"); }
//Insert Into Database
if(!mysql_query("INSERT INTO users (email, username, password) VALUES ('$Email', '$Username', '$Password')"))
{ die("We could not register you due to a error (Contact the website owner if this continues to happen.)");
}else{ die("User Created"); }
?>
And here are the outcomes -
Although i have put in the same email address that is already in the database it shows me the message -
You didn't enter a username!
so it doesn't check the database to if the email is already in there and i also now receive this error message -
Notice: Undefined variable: email_add in ...... on line 21