Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get total affected row counts in mysql using node.js
#1
Hello guys...

Today I am going to share a code that will helps you to get the total affected rows in Mysql Database using PHP Code. I am using the below code to select data from database in node.js.


Code:
app.get('/select', function(req,res){
  pool.getConnection(function(error,conn){
      var queryString = "SELECT * FROM `installation`";

      conn.query(queryString,function(error,results){
          if(error)
              {
                  throw error;
              }
          else
              {
                console.log("Total Records:- " + results.length);
              }

      });
      conn.release();
  });
});


On the above code, The below code will helps you to show the affected row counts from Mysql Database.


Code:
console.log("Total Records:- " + results.length);


I hope this worked well for you.

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)