【发布时间】:2016-02-12 05:41:43
【问题描述】:
我编写了这段代码,并尝试运行它以使用 node.js 变量更新数据库。脚本有效,但输入字符串“$var”而不是实际结果。请帮忙。
谢谢。
var TOTP = require('onceler').TOTP;
setInterval(function() {
// create a TOTP object with your Secret
var totp = new TOTP('CODEHERE');
$var:{totp.now}
// print out a code that's valid right now
console.log(totp.now());
$q="UPDATE auth SET auth =$var where id='1'";
con.query(
$q,function(err,rows){
if (err) throw err;
console.log('Data received');
console.log(rows);
})},5000);
【问题讨论】:
标签: javascript php mysql node.js