var async = require("async");
// ...
var tasks = [];
if (price) {
tasks.push(function(callback) {
connection.query('UPDATE fotopovtory SET price="' + price + '" WHERE foto_id = "' + itemId + '";', callback);
});
}
if (type) {
tasks.push(function(callback) {
connection.query('UPDATE fotopovtory SET tipe="' + type + '" WHERE foto_id = "' + itemId + '";', callback);
});
}
async.parallel(tasks, function(err) {
if (err) throw err;
res.end();
});