Ajax jQuery MySql PHP

JQuery – Username Availability Validation using PHP and MySQL

JQuery – Username Availability Validation using PHP and MySQL
Written by Yogesh Koli

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

jquery-username-validation-index-page

 

 

 

 

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 ):

error

 

Output (success message ):

success

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

About the author

Yogesh Koli

Yogesh Koli is a software engineer & a Blogger lives in India. He's driven by an addiction to learning and a love for adventure. he has 5+ years of experience working with the front-end, back-end, web application development, and system design.

2
Leave a Reply

avatar
2 Comment threads
0 Thread replies
0 Followers
 
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.

  Subscribe  
newest oldest most voted
Notify of
Dovhani Ramuthaga
Guest
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
Guest
Avdhesh Kumar

NICE