如果没有返回结果,如何设置 if 条件?
How to setup an if condition in the event no result is returned?
美好的一天,
我有以下查询:
// Add email later on
let sqlSelectBoxInformation = "SELECT DISTINCT longestDimension, box_id from box WHERE occupied ='unoccupied'";
connectionBoxInformation.query(sqlSelectBoxInformation, function(err, rows, fields) {
if (!err) {
// Check to see if the user entered hashtag is found in the database
// Create a variable to track if the item was found
var data = {
rows: rows,
userHashtag: databaseHashtag
}
res.render('delivery/chooseBox', data);
// Change the variable to true
wasFound = true;
}
如果因为没有结果可以满足这些要求而没有返回结果,我希望有一个 else 语句将用户呈现到另一个页面,但我不太确定我将如何进行。
那是什么模块?我假设这就是您所需要的。
if(!err){
if(rows.length > 0){
}
}
美好的一天,
我有以下查询:
// Add email later on
let sqlSelectBoxInformation = "SELECT DISTINCT longestDimension, box_id from box WHERE occupied ='unoccupied'";
connectionBoxInformation.query(sqlSelectBoxInformation, function(err, rows, fields) {
if (!err) {
// Check to see if the user entered hashtag is found in the database
// Create a variable to track if the item was found
var data = {
rows: rows,
userHashtag: databaseHashtag
}
res.render('delivery/chooseBox', data);
// Change the variable to true
wasFound = true;
}
如果因为没有结果可以满足这些要求而没有返回结果,我希望有一个 else 语句将用户呈现到另一个页面,但我不太确定我将如何进行。
那是什么模块?我假设这就是您所需要的。
if(!err){
if(rows.length > 0){
}
}