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

203
Views
I can't get in rows data of field when i use multiple query i use mysql, nodejs
if (command === "buy") {
  var query = `select piecoin from coin;` + `select cakecoin from coin;`;

  database.query(query, (err, rows, field) => {
    if (err) {
      console.log(err);
    } else {
      console.log(rows[0]);
    }
  });

Result: [ RowDataPacket { piecoin: 100 } ] If i change like this

else {
      console.log(rows[0].piecoin);
    }

Result: Undefined / I want to get Result data of field "100"

I can get result i want when i don't use multiple query like this

if (command === "buy") {
  var query = `select piecoin from coin;`;

  database.query(query, (err, rows, field) => {
    if (err) {
      console.log(err);
    } else {
      console.log(rows[0].piecoin);
    }
  });

Result: 100

I want get coin value and get user's money data then if buy a coin and decrease users'money

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

0

Have you ever set multipleStatements option to true in mysql db option? You have to do this to enable multi-query.


const mysql = require('mysql');

mysql.createConnection({
    user: 'db user',
    host: 'db host',
    database: 'db name',
    password: 'db password',
    port: 'db port',
    // multi query on
    multipleStatements: true,
})

try this

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!