почему условие не срабатывает? я вывожу console.log(query) пишет unsigned Код (Javascript): app.get('/smart', function(req, res) { var order; var side; var query; var smartphopneList=[]; order='priсe'; side='ASC'; // Connect to MySQL database. var connection = getMySQLConnection(); connection.connect(); // Do the query to get data. if((order=='name') && (side =='ASC')){ query='SELECT `id`,`prod`,`name`,`description`,`photo`,`price`,`popularity`,`sale` FROM `smartphone` ORDER BY `name` ASC'; }else if((order=='name') && (side=='DESC')){ query='SELECT `id`,`prod`,`name`,`description`,`photo`,`price`,`popularity`,`sale` FROM `smartphone` ORDER BY `name` DESC'; }else if((order=='price') && (side=='ASC')){ query='SELECT `id`,`prod`,`name`,`description`,`photo`,`price`,`potypulari`,`sale` FROM `smartphone` ORDER BY `price` ASC'; }else if((order=='price') && (side=='DESC')){ query='SELECT `id`,`prod`,`name`,`description`,`photo`,`price`,`popularity,`sale`` FROM `smartphone` ORDER BY `price` DESC'; }else if((order=='popularity') && (side=='ASC')){ query='SELECT `id`,`prod`,`name`,`description`,`photo`,`price`,`popularity`,`sale` FROM `smartphone` ORDER BY `popularity` ASC'; }else if((order=='popularity') && (side=='DESC')){ query='SELECT `id`,`prod`,`name`,`description`,`photo`,`price`,`popularity`,`sale` FROM `smartphone` ORDER BY `popularity` DESC'; }else if((order=='sale') && (side=='DESC')){ query='SELECT `id`,`prod`,`name`,`description`,`photo`,`price`,`popularity`,`sale`,(`price` / 100 * `discount`) AS `tsale` FROM `smartphone` ORDER BY `newprice` ASC'; }else if((order=='sale') && (side=='DESC')){ query='SELECT `id`,`prod`,`name`,`description`,`photo`,`price`,`popularity`,`sale`,(`price` / 100 * `discount`) AS `tsale` FROM `smartphone` ORDER BY `newprice` DESC'; } 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"}); } 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, 'popularity':req.cookies.sidepopularity, 'pricee':req.cookies.sideprice, 'sale':req.cookies.sidesale, 'sett':req.cookies.sett,/**/ } // Add object into array smartphopneList.push(smartphopne); } // Render index.pug page using array res.render('index', {"smartphopneList": smartphopneList}); } }); // Close the MySQL connection connection.end(); }); /// /// HTTP Method : GET /// Endpoint : /person/:id /// /// To get specific data of person based on their identifier. /// app.get('/somesmart', function(req, res) { var somesmartlist = []; // Connect to MySQL database. var connection = getMySQLConnection(); connection.connect(); // Do the query to get data. connection.query('SELECT `prod`,`name`,`sim`,`display`,`razresh`,`acum`,`proc`,`oper`,`sd`,`cam`,`gps`,`description`,`giroscope`,`payment`,`photo`,`price`,`webs`,`os`,`rom` FROM `smartphone` WHERE `id`='+ mysql.escape(req.params.id), function(err, rows, fields) { if (err) { res.status(500).json({"status_code": 500,"status_message": "internal server error"}); } else { // Check if the result is found or not // Create the object to save the data. var smart = { 'id':rows[0].id, 'prod':rows[0].prod, 'name':rows[0].name, 'sim':rows[0].sim, 'display':rows[0].display, 'razresh':rows[0].acum, 'acum':rows[0].acum, 'proc':rows[0].proc, 'oper':rows[0].oper, 'sd':rows[0].sd, 'cam':rows[0].cam, 'gps':rows[0].gps, 'description':rows[0].description, 'giroscope':rows[0].giroscope, 'payment':rows[0].payment, 'photo':rows[0].photo, 'giroscope':rows[0].giroscope, 'price':rows[0].price, 'webs':rows[0].webs, 'os':rows[0].os, 'rom':rows[0].rom, } somesmartlist.push(smart); // render the details.plug page. res.render('one', {"somesmartlist": somesmartlist}); } }); // Close MySQL connection connection.end(); });