Thursday 15 June 2017

Why my mysql query result contains FieldPackets?

Hello, im trying to render data from mysql in my .ejs file but i dont know why my result contains FieldPackets:[ FieldPacket { catalog: 'def', db: 'db', table: 'books', orgTable: 'books', name: 'id', orgName: 'id', charsetNr: 63, length: 11, type: 3, Here is my code: async.parallel([ function(callback) { mysqlConnection.query('SELECT * FROM books', callback) }, function(callback) { mysqlConnection.query('SELECT * FROM users', callback) } ], function(err, results) { console.log(results[0]) res.render('data', { books: results[0], users: results[1] }); }); I want only RowDataPacket becouse i need to render row objects I dont know if i render it correctly:
    <% books.forEach(function(ind){ %>
  • <%= JSON.stringify(ind) %>
  • <% }) %>
It would be great if someone could help me :)

Submitted June 15, 2017 at 03:10PM by elderdruid3

No comments:

Post a Comment