app.post( "/picture", jsonParser, function( request, response ) {
if ( !request.body ) {
console.log( "error" )
} else {
if(request.body.pictures == "one") {
connection.query( "SELECT * FROM picture WHERE `picture_sale` = '1' ORDER by picture_id DESC", function( err, result, fields ) {
for(var o of result) {
connection.query(`SELECT * FROM artist WHERE artist_id = ${o.picture_artist_id}`, function( err2, result2, fields2 ) {
o.name_created = result2.artist_name
})
}
console.dir(result)
response.json( result )
})}
}
} )
Тут цикл for, видимо, не изменяет значение. Подскажите, что делать?