gpt4 book ai didi

mysql - ER_PARSE_ERROR : You have an error in your SQL syntax;

转载 作者:行者123 更新时间:2023-11-29 06:30:35 25 4
gpt4 key购买 nike

为什么不起作用?我想下载txt并保存在数据库中。

Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual th at corresponds to your MySQL server version for the right syntax to use near 'a/ innego komunikatora. Z góry, wielkie dzięki. Temat będzie aktualizowany w m' at line 1

代码

var cheerio = require('cheerio');
const request = require('request');
var mysql = require('mysql');


var con = mysql.createConnection({
password..
});


con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
});


let x=1;

function downlad(){
x++;
request.get(`http://wklejto.pl/638151`, (err, response, body) => {
console.log(response.statusCode);
const $=cheerio.load(
body,
{ decodeEntities: false });

const el = $('.de1').html();

con.query("INSERT INTO `wklejki` (`ID`, `txt`) VALUES (NULL, '"+el+"');");

console.log(el);
});
}downlad();

Enter image description here

最佳答案

替换

con.query("INSERT INTO `wklejki` (`ID`, `txt`) VALUES (NULL, '"+el+"');");

con.query('INSERT INTO wklejki SET ?', {ID: null, txt: el}, function (error, results, fields) {
//Whatever you want to do next.
});

关于mysql - ER_PARSE_ERROR : You have an error in your SQL syntax;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56543121/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com