watkib
0
Q:

npm mysql


  var mysql = require('mysql');

var con = mysql.createConnection({
  
  host: "localhost",
  user: "yourusername",
  password: "yourpassword"

  });

con.connect(function(err) {
  if (err) throw err;
  console.log("Connected!");
});
 
2
$ npm install mysql
0
// Use https://github.com/JackChilds/jsmysqldb

// Then once it's setup you can just do this:

// Config that will be sent to server
const config = {
  "table" : "customers",
  "limit" : "50",
  "offset" : "0"
};

// Use the _POST_REQUEST function to send data to the server and get a response
_POST_REQUEST("link-to-server/database.php", 'config=' + JSON.stringify(config), (response) => {
  // Convert the response into an array of rows:
  var data = JSON.parse(response);
  // Now do what you want with data
  // data[row index][column name]
});
1

  var mysql = require('mysql'); 
0

New to Communities?

Join the community