Socket.io:如何将Javascript变量从socket.js中传递给mysql查询?

问题描述 投票:0回答:1

Socket.io:如何在socket.js中将JavaScript变量传递给mysql查询?

尝试将变量传递到mysql查询时出错。

任何帮助将不胜感激。

var number;

$query = 'INSERT INTO numbers VALUES (?)';

connection.query($query, number, function(err, result) {

if(err){
        console.log("An error occurred performing the query.");
        return;

}
    console.log("Query successfully executed: ", rows);

 });
javascript mysql variables socket.io
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.