I have the following problem. I have a function that fetches the result from 6 different MySQL tables with different columns and puts it into an array. The problem is the query runs through, all rows are found but not transferred to the target array. This remains always empty. I don't know for the life of me what the reason is. For more than 3 hours now I am on the hose.
Attached is my code:
const working_areas = [
'instandsetzung',
'strabasofomld3',
'inspektion',
'austausch',
'abbruch',
'deta'
]
var userWorkAll = function getUserWorkAll(email_decode) {
console.log(email_decode);
var newRow = [];
working_areas.forEach(function (area) {
connection.query('SELECT * FROM ' + area + ' WHERE ersteller = ?', [email_decode], (err, rows, fields) => {
if (!err) {
newRow.push(rows);
} else {
console.log(err);
}
});
});
//console.log(newRow);
return(newRow);
}
I hope for some final thoughts. Thanks <3
I tried to check if anywhere in the SQL Query mistakes are happening, printing out debug data. Everything works till there correctly.