0

I've Got a Small Script That Runs Continuously On My Server.

I'd Like To Connect It To a DB To Get Some Data For The Script's Operation. So, I Required The Custom Model I Built, And Node Recognises It - It Does Not Send Back An Error With "Module Not Found".

The DB Script Works, And Pulls Exactly What I Need From The DB. This Is How It Looks (Assume The Connection Is Open - This Is Just The Query & Response Code):

connection.query(sql, function (err,rows){

//Handle Errors
if(err){
    throw err;
}

//If Successful - Log Results For Now (Change To Export Results)
else{
    //console.log(rows);
    rows = exports.rows;
}

});

Unfortunately, Whenever I Call DB.rows In My Main Script, It Returns undefined.

Am I Exporting It Wrong Or The Problem Lies Deeper Within?

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.