This is in my routes/product.js file in my node.js/express project which is using express-myconnection. How do I return multiple data sets for the view to use? I have the data object and the dropdown object being populated by the same query. I want to keep the data object like it is, but populate the dropdown object with a different query.
exports.edit = function(req, res) {
var id = req.params.id;
req.getConnection(function (err, connection) {
connection.query('SELECT * FROM products WHERE product_id = ?', [id], function (err, rows) {
if (err)
console.log("Error Selecting : %s ", err);
res.render('products\\edit', {
page_title: "Product : Edit",
save_button_title: "Update",
data: rows,
dropdown:rows});
});
});
}