Asynchronous Database Problems with Node.js -
i trying query database, running on node server without express using sqlite3, check if element in database. upon finding if element exists, go on access different table information. var username; checksessionid(userssessionid, function(temp) { username = temp[0].username; }); var db = new sql.database("pete's fcrs.db"); var ps = db.prepare("select * users username = ?", errorfunc); ps.all(username, function(err, rows) { if (err) throw err; console.log(rows); }); ps.finalize(); db.close(); function checksessionid(sessionid, callback) { var db = new sql.database("pete's fcrs.db"); var ps = db.prepare("select * sessionids sessionid = ?", errorfunc); ps.all(sessionid, function(err, rows) { if (err) throw err; callback(rows); }); ps.finalize(); db.close(); } ("test: " + sessiondetails); 1) run checksessionid check if sessionid in database, in sessionids table. 2) next, calls callback function, store us...