Home Ajax JQuery – Username Availability Validation using PHP and MySQL

JQuery – Username Availability Validation using PHP and MySQL


jQuery Username Availability Validation

It is common operation on each sign up or the registration process, whenever we create or add new user in to the system we needs to add a common identifier for each user and that becomes username, it can be email address or just a string. having said that while doing this process we needs to validate the username and validation is actually check whether particular username is available to user or not.

Let’s make it simple to understand, in programming words check if is there any existing username is present in the database table

In this tutorial I am going to explain each aspect along with the source code. let’s get started step by step:

Step 1: Database Setup

Create MySQL database table to store users details. (if you have already created that’s fine! just match your field name with the source code) and have few dummy records record entries to test.

users table:

SQL Dummy Records:

Step 2: Start Programming

Create MySql Database Connection File:

2.1 Create DB connection file db_connection.php and use following code and update the connection variable settings according to your system settings.


Username Availability Check:

2.2 Create PHP file to check username : username_check.php


Sample Registration Form to Test Username:

2.3 Create Registration form with HTML and add Jquery and external javascript file (script.js) to head section: index.html






2.4 Create and open script.js file and write following code, to check username. : script.js


2.5 Review folder structure:

JQuery – Username Availability Validation using PHP and MySQL

Output (error message ):



Output (success message ):


Your done, run your code to checkout or you can download the source code from below link:

Enjoy this tutorial? Get iTech Empires updates delivered straight to your inbox.

No Spam, ever. We'll never share your email address and you can opt out at any time.

Yogesh Kolihttp://www.itechempires.com
Yogesh Koli is a software engineer & Blogger lives in India. He's driven by an addiction to learning and a love for adventure. he has 6+ years of experience working with the front-end and back-end web application development.


2 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
2 Comment authors
Dovhani RamuthagaAvdhesh Kumar Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

newest oldest most voted
Notify of
Dovhani Ramuthaga
Dovhani Ramuthaga

I followed all steps, also downloaded jquery-1.11.3.min.js file and included it in the head tag, but the test app, is silent as a picture

Avdhesh Kumar
Avdhesh Kumar


Tutorials You May Like!

- Advertisement -