\app.js:159
bb[1]=resulta;
^^
SyntaxError: Unexpected identifier
←[90m at wrapSafe (internal/modules/cjs/loader.js:1053:16)←[39m
←[90m at Module._compile (internal/modules/cjs/loader.js:1101:27)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:985:32)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:878:14)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m
C:\xampp\htdocs\mysite.local>node app
C:\xampp\htdocs\mysite.local\app.js:159
bb[1]=resulta;
^^
SyntaxError: Unexpected identifier
←[90m at wrapSafe (internal/modules/cjs/loader.js:1053:16)←[39m
←[90m at Module._compile (internal/modules/cjs/loader.js:1101:27)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:985:32)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:878:14)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m
app.get('/orders/:page', (req, res) => {
var connection = getMySQLConnection();
var smartphone=[];
var allsmartphone={};
var smartphoneList=[];
var allprice=0;
var a;
var b;
var length;
var orderids;
var start;
var end;
var allprice;
var bb=[];
start=(req.params.page-1)*10;
end=req.params.page*10;
var sql3='SELECT `id` FROM `orders`';
var sql2='SELECT `orderid` FROM `orders` GROUP BY `orderid`';
var sql1 ='SELECT `id`,`prod`,`name`,`photo`,`price`,`sale`,`remote_adr`,`quantity` FROM `orders` WHERE orderid=?';
function pquery (con, sql, par) {
return new Promise ( (res, rej) => {
con.query (sql, par, (err, result) => {
if (err) {
rej (err);
} else {
res (result);
}
});
});
}
Promise.all([
pquery (connection, sql3, []).then( resulta => {
length=resulta.length;
if(start<0){start=0;}
if(end>(length-req.params.page*10)%10){end=length;}
}),
pquery (connection, sql2, []).then( result => {
orderids=result;
})
bb[1]=resulta;
bb[2]=result;
]).then ( (bb) => {
/*for(var j=0;j<orderids.length;j++) {
connection.connect(function(err) {
connection.query(sql, [orderids[j]], function (err, result) {
for (var i = 0; i < results.length; i++) {
// Create the object to save the data.
b = results[i].price - results[i].price * results[i].sale / 100;
a = b * results[i].quantity;
allprice += a;
var smart = {
'id': results[i].id,
'prod': results[i].prod,
'name': results[i].name,
'photo': results[i].photo,
'sale': results[i].sale,
'price': results[i].price,
'tsale': b,
'vsego': a,
'quantity': results[i].quantity,
'allprice': allprice,
};
smartphone.push(smart);
}
});
allsmartphone.push= smartphone;
});
});*/
console.log("len: " + bb[1]+" orderids: "+bb[2]);
//res.render('orders', {"smartphoneList": smartphoneList,"allsmartphone": allsmartphone,'orderids':orderids});*/
});
});
не передается bb