admin管理员组文章数量:1400108
mysqlconnection.query("SELECT userID FROM users_session WHERE userSessionID = '" + SESSION_ID_ESCAPED + "'", function SelectCb (err, rows) {
if (err) {
throw err;
}
else {
console.log(rows[0]);
}
How do I turn row[0]
into a string
so that the browser can view it?
The console tells me rows[0] = {userID: 2}
// This is [object Object]
in any sort of transfer.
I used , var TheID = rows[0].toString //
TheID is now undefined when console.log'd or sent out.
mysqlconnection.query("SELECT userID FROM users_session WHERE userSessionID = '" + SESSION_ID_ESCAPED + "'", function SelectCb (err, rows) {
if (err) {
throw err;
}
else {
console.log(rows[0]);
}
How do I turn row[0]
into a string
so that the browser can view it?
The console tells me rows[0] = {userID: 2}
// This is [object Object]
in any sort of transfer.
I used , var TheID = rows[0].toString //
TheID is now undefined when console.log'd or sent out.
- Does this answer your question? Why does `Object.prototype.toString` always return `[object *]`? – Vasyl Moskalov Commented May 18, 2022 at 10:23
2 Answers
Reset to default 7try:
var TheID = rows[0]['userID'].toString();
try this..
console.log(rows[0].userID);
you will get the userID.
本文标签: ToString changes Javascript Object to UndefinedStack Overflow
版权声明:本文标题:ToString changes Javascript Object to Undefined - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744171743a2593815.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论