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

313
Views
Node js , cannot retrive data from sqlight3 table

async function  get_info(compName)  {
    let company   = {
        name:""
        , activityNumber:""
        , siret :""
        , adresse :""
        , tva :""
        , logo:0
    };
    buff = await db.all("SELECT * FROM company WHERE name = ?", [compName], (err, rows) => {
        if (err) {
            console.log(err)
            return err;
        }
        rows.forEach(element => {
            console.log(element.name) // WORK
            company.name =   element.name;
            company.activityNumber =  element.activityNumber;
            company.adresse = element.adresse;
            company.logo =  element.logo;
            company.siret =  element.siret;
            company.tva =  element.tva;
        });
       
    });
    console.log(" ... " + company.name) // DOSENT WORK
    return company;
}

I'm trying to get company fill and get data out of my database. The first console.log() is good but not the second one, it's empty, and the object it returns have defaults values, there will be only one element who will match "WHERE name = ?" so I don't worry about erasing the value.

about 4 years ago · Juan Pablo Isaza
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!