в таблице есть 'priсe' не знаю почему ошибка. Error: ER_BAD_FIELD_ERROR: Unknown column 'priсe' in 'order clause'
app.get('/smart', function(req, res) {
var order;
var side;
order=req.cookies.sett;
if(order=='price'){
side=req.cookies.sideprice;
}else if(order='popularity'){
side=req.cookies.sidepopularity;
}else if(order='tsale'){
side=tsale;
}
if(!order){order='name';}
if(!side){side='ASC';}
var query;
var smartphopneList=[];
order='priсe';
side='ASC';
// Connect to MySQL database.
var connection = getMySQLConnection();
connection.connect();
// Do the query to get data.
query='SELECT `id`,`prod`,`name`,`description`,`photo`,`price`,`popularity`,`sale`,(`price` -`price` / 100 * `sale`) AS `tsale` FROM `smartphone` ORDER BY '+order +" "+side;
console.log("query: "+query+" order: "+order+" side: "+side);
connection.query(query, function(err, rows, fields) {
if (err) {
res.status(500).json({"status_code": 500,"status_message": "internal server error"});
console.log(err);
} else {
// Loop check on each row
for (var i = 0; i < rows.length; i++) {
// Create an object to save current row's data
var smartphopne = {
'id':rows[i].id,
'prod':rows[i].prod,
'name':rows[i].name,
'photo':rows[i].photo,
'description':rows[i].description,
'price':rows[i].price,
'len':rows.length,
'tsale':rows.tsale,
}
// Add object into array
smartphopneList.push(smartphopne);
}
// Render index.pug page using array
res.render('index', {"smartphopneList": smartphopneList});
}
});
// Close the MySQL connection
connection.end();
});