Saturday, 8 April 2017

SyntaxError: missing ) after argument list in javascript

This is the error but I am not able to pinpoint it. The query runs fint when run from phpmyadmin SQL console

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)

The error:

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)

The Javascript code:

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);
            });

        };



via yuvasree kalaiselvan

No comments:

Post a Comment