我在 nodeJS 中得到了一个像 getItemPrice 这样的函数。但是在尝试插入数据时出现错误。不能在 VALUES(item.Id, value.lowest_price) 中写入任何动态值。
我已经尝试了很多东西 bot 没有工作。
con.query('SELECT game_item.id as itemId, steam_app_game.app_id as gameId, game_item.name, steam_app_game.id FROM steam_app_game LEFT JOIN game_item ON steam_app_game.id = game_item.app_game_id', function(err, rows, fields) {
var counter = 1;
rows.forEach(function (item,index) {
setTimeout(function(){
market.getItemPrice(item.gameId, item.name).then(function (value, err) {
if(err) throw err;
var lowest = value.lowest_price
con.query('INSERT INTO game_item_spec(game_item_id,price) VALUES (item.itemId,value.lowest_price )')
counter ++;
});
}, index * 5000);
});
});
这是错误。
ER_BAD_FIELD_ERROR: Unknown column 'value.lowest_price' in 'field list'
at Query.Sequence._packetToError (F:\Xamp\htdocs\steam-trade-bot\node_modules\mysql\lib\protocol\sequences\Sequence.js:47
:14)
我使用 nodeJs 中的参数语句解决了这个问题。如果数据具有特殊字符,则单次插入不起作用
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句