mysql = require('mysql')
connection = mysql.createConnection({
host : 'localhost',
user : 'xxx',
password : 'ccc',
database : 'vvv'
});
var post = {text: 'abc' };
var query = connection.query('INSERT INTO texter VALUES ?', post, function(err, result) {
});
console.log(query.sql);
INSERT INTO texter VALUES `text` = 'abc'
Таблица состоит из одного поля text, но ничего не добавляется, почему? connection.connect();
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'me',
password : 'secret'
});
connection.connect();
connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
if (err) throw err;
console.log('The solution is: ', rows[0].solution);
});
connection.end();