node.js - node | MySQL multiple WHERE with AND clause -


i trying statement in node using mysql package. trying select table where and clause such where id = 1 , course = 1 far i've got far being able select i'm getting error, can see error though , it's there no and when binding id.

this current code.

let sql = 'select * users ?';  let values = {     id: 1,     course: 1 }  database.query(sql, values, (err, result) => {  } 

this error getting...

select * users id = 1, course = 1

the query once has been through node missing and

any appreciated.

probably should smth this:

let sql = 'select * users id = ? , course = ?';  database.query(sql, [1, 1], (err, result) => {  } 

https://www.w3schools.com/nodejs/shownodejs_cmd.asp?filename=demo_db_where_placeholders


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -