這是錯誤,但我無法找到它。從phpMyAdmin的SQL控制檯運行時,運行查詢FINTSyntaxError:missing)在javascript中的參數列表後
var query = connection.query('Select distinct a.*, IFNULL(b.scannerid,'Not Available') AS `scannerid`, IFNULL(date(b.datetime),'Not Available') as datetime, IFNULL(b.status,'Absent') AS `status` from studentdetails a LEFT OUTER JOIN discovereddevices b ON a.bluetoothid = b.blueid and date (b.datetime) = CURRENT_DATE',function(err,rows)
錯誤:
SyntaxError: missing) after argument list
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/ubuntu/Attendance system/app.js:13:24)
的JavaScript代碼:
exports.getattendance = function(req, res){
req.getConnection(function(err,connection){
var query = connection.query('Select distinct a.*,
IFNULL(b.scannerid,'Not Available') AS `scannerid`,
IFNULL(date(b.datetime),'Not Available') as datetime,
IFNULL(b.status,'Absent') AS `status` from studentdetails a LEFT OUTER
JOIN discovereddevices b ON a.bluetoothid = b.blueid and date (b.datetime)
= CURRENT_DATE',function(err,rows)
{
if(err)
console.log("Error Selecting : %s ",err);
res.render('showreport',{page_title:"Attendance Report Generated",data:rows});
});
//console.log(query.sql);
});
};
看看嵌套的單個問題 – Jens
問題區域是引號,換句話說就是'\'不可用\「 – Satpal
你不能用新行符將行字符串打斷。閱讀javascript中的多行字符串 – dfsq