Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

340
Views
mysql query :parse error IN clause

I am trying to execute a mysql query in express js application

    function(req,res){
           var params = [req.body.category,1]
           db.query("SELECT * FROM TABLE WHERE category IN ? AND status=?",[params],function(error,result){
           console.log(error);
  })
      

Here is the input value of req.body.category : ["pen","book"]

UPDATE

Based on comments i've changed my query and the input

 final query "SELECT * FROM TABLE WHERE category IN ("+req.body.category+")"
 

input:"'f','test'"

However this works fine but query still vulnerable to sql injection attack so i enclosed it with db.escape(req.body.category) but it returns empty result

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!