I am making a registration in which can not have users with the same name / nick registered. To validate whether or not I use PHP, I would like to know how to print a p with a message on the screen if a user with that name already exists. I tried to do this, but it does not work
if(is_null($id)){
$sql = "INSERT INTO usuario (nick, email, senha) VALUES ('$nick' , '$email' ,'$senha')";
$q = mysqli_query($con,$sql);
$url = 'aux.php';
echo'<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
}
else{
?>
<script type='text/javascript'>
var uso = document.getElementById('emUso');
uso.innerHTML = 'Este nick já está em uso!'
</script>
<?php
}