0

I have a problem with function check_mod.

function check_mod(user_id) {
    db.each(`SELECT mode FROM users WHERE id = ` + user_id, [], (err, row) => {
        if (err) {
            throw err;
        }
        if(row.mode == 1)
        {
            return true;
        }
    });
}

if(check_mod('286927644405137408')) console.log("okay");

When i try to use this function, it returns "undefined" and i don't know why. I think that i should use async and await but i don't know how to use it.

J. Doe
  • 1

1 Answers1

0

I'm not sure but, I do notice that there is no semicolon at the end of the sql statement which could be causing the issue.

Mike Sraj
  • 81
  • 1
  • 4