function checkQTY(qty, id) {
    connection.query("SELECT * FROM products WHERE stock_quantity = 0 ORDER BY department_name;", function (err, results) {
        if (err) throw err;
        let qtyYes = false;
        for (let i = 0; i < results.length; i++) {
            if (id == results[i].item_id) {
                qtyYes = true;
                console.log("*********We are out-of-stock today, sorry try again in a few days!.*********");
                prompter();
                break;
            }
        }
        if (qtyYes === false) {
            qtyMath(qty, id);
        }
    });
}
//If the items are in stock then call math function.  
If the items are in stock then call math function.
If the items are in stock then call math function .
function checkQTY(qty, id) {
    connection.query("SELECT * FROM products WHERE stock_quantity = 0 ORDER BY department_name;", function (err, results) {
        if (err) throw err;
        let qtyYes = false;
        for (let i = 0; i < results.length; i++) {
            if (id == results[i].item_id) {
                qtyYes = true;
                console.log("*********We are out-of-stock today, sorry try again in a few days!.*********");
                prompter();
                break;
            }
        }
        if (qtyYes === false) {
            qtyMath(qty, id);
        }
    });
}
function checkQTY ( qty , id ) { connection . query ( "SELECT * FROM products WHERE stock_quantity = 0 ORDER BY department_name;" , function ( err , results ) { if ( err ) throw err ; let qtyYes = false ; for ( let i = 0 ; i < results . length ; i ++ ) { if ( id == results [ i ] . item_id ) { qtyYes = true ; console . log ( "*********We are out-of-stock today, sorry try again in a few days!.*********" ) ; prompter ( ) ; break ; } } if ( qtyYes === false ) { qtyMath ( qty , id ) ; } } ) ; }
If the items are in stock then call math function.
If the items are in stock then call math function .