let person_id = "";
connection.query(
`SELECT max(person_id) as person_id FROM persons WHERE phone_num = '${req.body.phone_num}'`,
(err, result) => {
person_id = result[0].person_id;
console.log(person_id) // has an output
}
);
console.log(person_id); //no output