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

183
Views
Cómo detectar si where no tiene resultado

Mi código

 stmt.bind({$ticket:"ABCD1245"}); while (stmt.step()) console.log(stmt.get());

da un resultado como [1], eso es correcto

 stmt.bind({$ticket:"ABCD1245a"}); while (stmt.step()) console.log(stmt.get());

no da ningún resultado, lo cual está bien, porque no existe ningún registro.

¿Cómo detecto si no se encontró ningún registro? Intenté como stmt.numrows, pero parece que no es compatible.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Lo arreglé de esta manera, me gustaría usar stmt.num_rows

 ticket= "ABCD1245A"; stmt.bind({$ticket:ticket}); if(stmt.step()){ console.log(stmt.get()); console.log(ticket+' found'); while (stmt.step()) console.log(stmt.get()); }else{ console.log('No result for '+ticket); }
about 4 years ago · Juan Pablo Isaza Report
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!