if(!$query=@mysqli_query($mysqli, "SELECT COUNT(id) FROM users WHERE email='".mysqli_real_escape_string($mysqli, $_POST['email'])."'"))
exit('Fatal error: '.mysqli_error($mysqli));
if(mysqli_num_rows($query)>0)
echo 'Такой email уже зарегистрирован!<br>';