I'm running into a issue when trying to display info on my website through a js widget, i'm fairly new to js in general so i cant seem to figure out where the problem lies.
series: [
var query = connection.query(sql, function(err, result){
console.log(+ result.length)
});
, 0, 0],
here is where its going wrong.
when its saved and i refresh the
var query = connection.query(sql, function(err, result){
console.log(+ result.length)
});
is breaking everything and the rest of my JS widgets disappear untill i remove it.
at the top of my js file is where i call the db connect, no where near where im trying to call the result
var mysql = require('mysql');
var connection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '',
database: 'testdistress',
debug: false,
});
console.log("Connected to Mysql");
connection.connect();
var sql = "SELECT * FROM offers";
When i tested it in the node.js console everything worked fine.. it gave me back everything i needed. where am i going wrong?