In general, here is the processing script, here it is simple, first the stlen field is checked, then it is checked for the repetition of the password; login is busy, displays, but in the loop, login is busy login is busy, etc. It seems to be correctly written, but if in a cycle, then there will be as many records displayed as there are records in the database, how to get out of this impasse.
$userstable = mysql_query("SELECT * FROM users"); if(strlen($name) > 1 AND strlen($email) > 1 AND strlen($music) > 1 AND strlen($password > 1 AND strlen($repassword) > 1){ if($password == $repassword){ while($relogin = mysql_fetch_array($userstable)){ if($name != $relogin['name']){ $insertusersdb = mysql_query("INSERT INTO users (`name`, `email`, `genre`, `password`) VALUES ('$name', '$email', '$music', '$password')"); echo '<script>$("#submitregister").html("Идет регистрация...");</script>'; if($insertusersdb == true){ echo ' <script>setTimeout(function(){ $("#register-block").css("margin-top","-295px"); $("#errormass").fadeOut(250).empty(); $("#submitregister").html("Заригестрироваться").fadeIn(2000); $("#formregistrationmain")[0].reset(); },2000); $("#submitregister").html("Регистрация завершена"); </script>'; echo '<p style="color:green;">Спасибо за регистрацию</p>'; } } else{ echo 'Извените, но такой логин уже занят!'; } } } }