Search Filter using Nodejs and MySQL

Search Filter using Nodejs and MySQL

In this Post We Will Explain About is Search Filter using Nodejs and MySQL With Example and Demo.Welcome on Live24u.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Ajax Search Box using Node and MySQL Example

In this post we will show you Best way to implement Ajax Search box using Nodejs and MySQL, hear for Search record with two fields from MYSQL table by using Node.js with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Also Read :   MySQL LIKE operator string function Example




Ajax Search box using Nodejs and MySQL

we prepare a simple connection by using mysql.createConnection() method of database connect MySQL simple module.There are simple very some things that we have to data define inside our create db connection data methods like localhost host name, simple user name, set your password, and set your database name.

Database details: connect with Node.js

  • set Hostname: localhost
  • database Port number: Set 3306
  • set Username: root
  • set Password: live24u.com
  • simple set Database: Live24u
  • Set Table name: users
  • Fields: user_id and name
  • Server File : Node.js

    step-1 : prepare a connection

    var mysql = require('mysql');
    

    step-2 : Database Connect MYSQL table by using Node.js

    var DB_Conn = mysql.createConnection({
      host: "localhost",
      user: "root",
      password: "Db458@#fdfjdf",
      database: "Live24u"
    });
    

    step-3 : query() method

    DB_Conn.connect(function(db_error) {
      if (db_error) throw db_error;
      console.log("Connected!");
      var sql = "select * from users where user_id='1' and name='jaydeep'";
    

    step-4 : query() method

    DB_Conn.connect(function(db_error) {
      if (db_error) throw db_error;
      console.log("Connected!");
      var sql = "select * from users where user_id='1' and name='jaydeep'";
    //step-4
      DB_Conn.query(sql, function (db_error, result) {
        if (db_error) throw db_error;
        console.log(result);
      });
    });
    

    Discussing steps that we have followed in our server file:

    1.Require simple MySQL module.
    2.Make Connection some variable using mysql.createConnection() function.
    3.Connect by using con.connect() function.
    4.make a SELECT Simple SQL some query by using data fields set user_id and name.
    5.Execute some query string by using .query() function.
    6.Show data result.

    Also Read :   AngularJs Encode and Decode URL example

    Connecting nodejs app to Mysql

    You are Most welcome in my you tube Channel Please subscribe my channel. and give me Feed Back.
    More Details……
    Angularjs Example





    Example

    I hope you have Got What is nodejs ajax search bar with javascript ,juquery and mysql database And how it works.I would Like to have Feed Back From My Blog(live24u.com) readers.Your Valuable Feed Back,Any Question,or any Comments about This Article(live24u.com) Are Most Always Welcome.