如何使插件工作?

How can i make the below code work!It's a connection to the db.Whene a user tries to sign up i want to display an error if their email input exists try another one but if its not then you are signed up!

$query = "SELECT * FROM `TesteExample` WHERE Email_address = '".mysqli_real_escape_string($link,$_POST['email_address'])."'";

$resultQuery  = mysqli_query($link,$query);

$resultsQuery = mysqli_num_rows($resultQuery);
//We test if the email the user tries is already registered.If it is then we tell him to create one.

if($resultsQuery) { 
    $AlreadyExists = "There is already a user with this email address.Please try another one."; 
} else {    
   $query = "INSERT INTO `TesteExample`
    (`Name`, `Surname`, `Email_address`, `Password`, `Gender`, `Comment`, `Country`, `ListOfDates`, `ListOfMonths`, `ListOfYears`, `Website`) 
    VALUES ('".$_POST['name']."','".$_POST['surname']."','".mysqli_real_escape_string($link,$_POST['email_address'])."','".$_POST['password']."','".$_POST['gender']."','".$_POST['comment']."','".$_POST['country']."','".$_POST['listOfDates']."','".$_POST['listOfMonths']."','".$_POST['listOfYears']."','".$_POST['website']."')";

    mysqli_query = ($link,$query);

Notitce that is i comment out the else statement everything works fine.But if i include it the whole page doesnt work.. I want you to know that some of them like(country) is data from a dropdown list or (gender) is a radio button. Do i have to specify anything else at the INSERT INTO ????