Posted inJavaScript / jQuery

check username availability using ajax and javascript – How to check if username already exists in database using JavaScript?

check username availability using ajax and javascript Live Username Availability Check using PHP and jQuery AJAX Example with full source code.

check username availability using ajax and javascript, PHP with MySQL

The CheckAvailability JavaScript function gets called when the Button is clicked.

Database Script for members Table

members.sql

CREATE TABLE IF NOT EXISTS `members` (
  `memberId` int(8) NOT NULL AUTO_INCREMENT,
  `memberName` varchar(55) NOT NULL,
  `password` varchar(55) NOT NULL,
  `firstName` varchar(55) NOT NULL,
  `lastName` varchar(55) NOT NULL,
  PRIMARY KEY (`memberId`)
)

INSERT INTO `members` (`memberId`, `memberName`, `password`, `firstName`, `lastName`) VALUES
(24, 'Rakesh', '', 'Rakesh', 'Bhandeto'),
(26, 'milan', '', 'davada', 'demoliya'),
(27, 'krish', '', 'krishna', 'kkv'),
(28, 'mayur', '', 'mayur', 'dhameliya');

Database connection

DatabaseConfig.php

link = $this->connectDB();
        if(!empty($this->link)) {
            $this->selectDB();
        }
    }
    
    function connectDB() {
        $link = mysqli_connect($this->host,$this->user,$this->password,$this->database);
        return $link;
    }
    
    function selectDB() {
        mysqli_select_db($this->link, $this->database);
    }
    
    function numRows($query) {
        $result  = mysqli_query($this->link, $query);
        $rowcount = mysqli_num_rows($result);
        return $rowcount;
    }
}
?>

Don’t miss : PHP JQuery AJAX Live Check Email Availability

Check Username Availability Form Interface

jQuery AJAX Handler to Request User Availability
index.php





Match Username against Database using PHP

check_availability.php

numRows($query);
  if($member_count>0) {
      echo " membername Not Available.";
  }else{
      echo " membername Available.";
  }
}
?>

I hope you get an idea about check username availability using ajax and javascript.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype