I am trying to get some records from my database in node JS with the MYSQL library but i am getting the wrong value for the column pid. It returns 76561198056610560 every time for all records even when the value of that column is something else.
This is what my table looks like:
did int(10) unsigned NO PRI NULL auto_increment
pid bigint(20) unsigned NO MUL NULL
oid int(10) unsigned NO NULL
secretcode varchar(255) NO NULL
reward int(10) unsigned NO NULL
status tinyint(1) NO NULL
offersent tinyint(1) NO NULL
created_at timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
updated_at timestamp NO 0000-00-00 00:00:00
Contents of the table:
1 76561198056610558 0 @JAMIE@SECRET1 100 0 0 2016-01-21 10:09:30 0000-00-00 00:00:00
2 76561198056610560 0 @JAMIE@SECRET2 100 0 0 2016-01-21 10:09:32 0000-00-00 00:00:00
3 76561198056610562 0 @JAMIE@SECRET3 100 0 0 2016-01-21 10:09:35 0000-00-00 00:00:00
My code:
connection.query('SELECT * from deposit WHERE offersent = 0;', function(err, rows, fields) {
if (!err){
for (var i in rows) {
logger.debug(rows[i])
logger.info(rows[i].pid);
}
}else{
logger.debug('SQL Error: '+ err);
}
});
The output
debug: did=1, pid=76561198056610560, oid=0, secretcode=@JAMIE@SECRET1, reward=100, status=0, offersent=0, created_at=Thu Jan 21 2016 10:09:30 GMT+0100 (CET), updated_at=0000-00-00 00:00:00
info: 76561198056610560
debug: did=2, pid=76561198056610560, oid=0, secretcode=@JAMIE@SECRET2, reward=100, status=0, offersent=0, created_at=Thu Jan 21 2016 10:09:32 GMT+0100 (CET), updated_at=0000-00-00 00:00:00
info: 76561198056610560
debug: did=3, pid=76561198056610560, oid=0, secretcode=@JAMIE@SECRET3, reward=100, status=0, offersent=0, created_at=Thu Jan 21 2016 10:09:35 GMT+0100 (CET), updated_at=0000-00-00 00:00:00
info: 76561198056610560