user2253758
user2253758

Reputation: 13

how to fetch value from JSON object?

I want to delete data from the table and database using multiple select. but it only deletes the first row selected. I also use the Firebug to fetch the req.body.id for the WHERE condition of my sql query, and it gives this POST request:

id 139,138 oper del

It only delete the row with the Id number 139.

heres my query:

connection.query("DELETE FROM "+content.table+" WHERE ?",content.condition,function(err,result){

content.condition= {id:req.body.id};

so the actual query became like this:

"DELETE FROM TABLE WHERE id = 139,138"

Sorry for my poor english, but I hope someone could help me! any help will be appreciated.

Upvotes: 1

Views: 113

Answers (1)

Nicolas
Nicolas

Reputation: 2367

The proper syntax for WHERE is WHERE ID IN (id1, id2, ..., idn)

Upvotes: 2

Related Questions