我在mySQL查询中搜索data.mesaj
但连接正在运行导致查询未运行,现在还会data.mesaj
做什么,但我不想这样:
data = { mesaj: '\nHello', uid: 'mustafa' }
y=data.mesaj;
var row = [];
connection.query('select * from yapay_zeka where yapay_zeka.soru = y ', function (err, rows) {
if (err) {
console.log(err);
} else {
if (rows.length) {
for (var i = 0, len = rows.length; i < len; i++) {
row[i] = rows[i];
console.log(row);
}
}
}
答案 0 :(得分:1)
connection.query("SELECT * from yapay_zeka WHERE yapay_zeka = '"+y+"'",
function(err, data) {});
connection.query("SELECT * from yapay_zeka WHERE yapay_zeka = '"+y+"'",
function(err, data) {});
答案 1 :(得分:0)
我找到了它:
connection.query("select * from yapay_zeka where yapay_zeka.soru = ?',[data.mesaj]