Thursday 18 May 2017

Node.js Socket.io Login

I've got a short question. I've programmed a connection to my SQL database from server.js. I also have a select for the things i want. My only problem is how can i start the method from the html file? The function itself is on the server side. I heard theres an emit command, and if, how does it work?

This is the thing i want to start(serverside)

   connection.query('select count(*) from TUsers;', function(err, result) {
  if (err) throw err
  var cn = result;
  for (var x = 0; x < y; x++) {
    var sql = `SELECT UserPwD from TUsers where UserNick='${user.username}';`;

    connection.query(sql),
      function(err, result) {
        var nick = result;
        if(dbpw === user.username){
          console.log('Correct');
        } else {
          console.log('Not correct');
        }
      }
  }
});



via Simon.B

No comments:

Post a Comment