INDIA, STD Code Finder Script in PHP, MYSQL, JQUERY

Here i am going to share one useful database that is STD code list of india in MYSQL and EXCEL with STD Code finder script in PHP, MYSQL, JQUERY.

If you are planning to create any telecommunication based website then it may help you, Here i have share full database with script, In STD code finder script i used jquery auto-complete feature, You can read tutorial how to create auto-complete/auto-suggest
So lets start the tutorial

Create your html file. with some css and required javascript, don’t forget to include jquery library.


<!doctype html>
<html lang="en">
  <meta charset="utf-8">
  <title>INDIA, STD Code Finder Script in PHP, MYSQL, JQUERY</title>
  <link rel="stylesheet" href="">
  .ui-autocomplete-loading {
    background: white url("img/ui-anim_basic_16x16.gif") right center no-repeat;
   .ui-autocomplete {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
  * html .ui-autocomplete {
    height: 100px;
<h3>INDIA, STD Code Finder Script in PHP, MYSQL, JQUERY</h3>
	<div class="ui-widget">
  <input type="text" id="std" name="std" placeholder="Type city name or std code" style="width:550px;"><br/>
  <span style="color:red">* Enter atleast 3 character..!! </span>
  <script src=""></script>
  <script src=""></script>
  $(function() {
   $( "#std" ).autocomplete({
      source: function( request, response ) {
          url: "request.php",
          dataType: "json",
          data: {
            q: request.term
          success: function( data ) {
            response( data );
      minLength: 3,
      select: function( event, ui ) {
      open: function() {
      close: function() {

Create server file to fetch data from database and return in json format.

$hostname = "localhost";
$username = "username";
$password = "db-password";
$dbname = "database-name";
$q = $_GET['q'];
if(isset($q) || !empty($q)) {
	$con = mysqli_connect($hostname, $username, $password, $dbname);
    $query = "SELECT * FROM stdcodes WHERE CONCAT(city, ' ', stdcode) LIKE '%$q%'";
    $result = mysqli_query($con, $query);
    $res = array();
    while($resultSet = mysqli_fetch_assoc($result)) {
	 $res[$resultSet['id']] = $resultSet['city'].", STD-CODE: ".$resultSet['stdcode'];
    if(!$res) {
    	$res[0] = 'Not found!';
    echo json_encode($res);

Use below button to see live demo and download source code with database.


If you like this post please don’t forget to subscribe my public note book for more useful stuff