I'm receiving this error of undefined data.
throw err; // Rethrow non-MySQL errors
TypeError: Cannot read property 'updates_title' of undefined
My node.js code which is causing an issue:
app.get("/aktualnosci/:update_id", function(req, res){
console.log(req.params.update_id);
con.query("SELECT * FROM tbl_updates WHERE updates_id = ('"+req.params.update_id+"')" , function(err, result, fields){
console.log(result[0]);
res.render('aktualnosci', {title: result[0].updates_title, text: result[0].updates_title});
});
});
Jade code:
.container
hr
.row
.col-lg-6
h1 #{title}
.row
.col-lg-12
p #{text}
Also i got console log of data i'm receiving from database
RowDataPacket {
updates_id: 4,
updates_title: 'Czwarty post, !!!',
updates_text:'LOREMLOREMLOREMLOREMLOREMLOREMLOREMLOREMLOREMLOREMLOREMLOREMLOREMLOREMLOREMLOREMLOREMLORLOREMLOREMLOREMLOREMLOREM' }
The problem is why the error is occurring when it's clearly shown that data is not undefined.