Can anyone help me regarding the issue of MySQL form validator that I want to apply to my web page?
How can I validate the form in case if the username in the database already exists when a new user wants to create the account?
I need the expert opinion.
Validating the Form with MySQL
You need to create an SQL which will filter the database to look for username in your table which is the same to the username that the user enters. To do that I used PHP as programming code to connect to MySQL database and validate the user.
<? PHP
$ username =$_POSTÂ [username];
If (MySQL_num_rows (MySQL_query ("SELECT fldusername FROM users WHERE fldusername = '$ username '")))
{
$msg=$msg."username already exists";
}
?>PHP
If data on your database table matched to user inputted username then it will give an error message saying that the username already exist. You can use this query in any filed also.
Hope this helped you.