let dbResult
//insert marker into db
await pool.query(
'INSERT INTO markers (title, description, creator, active) VALUES ($1, $2, $3, $4) RETURNING *',
[title, description, creator, active],
(error, results) => {
if (error) {
throw error
}
dbResult = results;
});
console.log(dbResult)
Not really sure why but the dbResult
variable is not being changed. I'm not very experienced with JavaScript, can anyone explain why this is happening.