正常的sql的like操作:
select * from job_info where job_name like '%web%'
错误的Node中的like写法:
var name = req.query.name;
let sql = "select * from job_info where job_name like '%?%'";
db.query(sql,name, (err, rows) => {
if (err) {
} else {
}
})
正确的写法
var name = "%" + req.query.name + "%";
let sql = "select * from job_info where job_name like ?";
db.query(sql,name, (err, rows) => {
if (err) {
} else {
}
})