How about I have the following code:
function login(req, res){
req.getConnection((err, conexion)=>{
if(err) return next(err);
conexion.query('select * from tabla where id=?', req.body.id, (err, dato)=>{
res.status(200).send({ campos: dato });
});
});
}
the json datum throws me the following:
{
"campos": [
{
"id": 12,
"campo1": "rulo",
"campo2": "a$10$gIoFFPgXcDoJ07CN1qq",
"campo2": "administrador"
}
]
}
and I want to take the value of the field2.
already try with a for and foreach, but I can not access this data ...
thanks in advance.