title: Heroku Node.JS Database Error
body: <p>I have a Node.JS application that is deployed with Heroku featuring a simple CRUD system. However, I am having problems whenever I update a row with the web application itself. </p>
  
  <p>Here is my code for the UPDATE statement in my server.js file</p>
  
  <pre><code>app.post('/logs/edit/:mobile', function(req, res){
     var input = JSON.parse(JSON.stringify(req.body));
     var mobile = req.params.mobile;
     var data = {            
          last    : input.last,
          first   : input.first,
          middle  : input.middle,
          mobile  : input.mobile,
          email   : input.email,
          bday    : input.bday,
          status  : input.status
     };
     connection.query("UPDATE logs set ? WHERE mobile = ? ",[data,mobile], function(err, rows){  
        if(err) console.log(err);
        res.redirect('/logs');          
     });
  });
  </code></pre>
  
  <p>Then here is the error showing in my logs</p>
  
  <pre><code>2017-06-27T02:09:55.662620+00:00 app[web.1]: { Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Doe', 'Doe', 'Doe', `first` = 'John', 'John', `middle` = 'Mike', 'Mike', `mobil' at line 1
  2017-06-27T02:09:55.662637+00:00 app[web.1]:     at Query.Sequence._packetToError (/app/node_modules/mysql/lib/protocol/sequences/Sequence.js:48:14)
  2017-06-27T02:09:55.662639+00:00 app[web.1]:     at Query.ErrorPacket (/app/node_modules/mysql/lib/protocol/sequences/Query.js:83:18)
  2017-06-27T02:09:55.662640+00:00 app[web.1]:     at Protocol._parsePacket (/app/node_modules/mysql/lib/protocol/Protocol.js:280:23)
  2017-06-27T02:09:55.662641+00:00 app[web.1]:     at Parser.write (/app/node_modules/mysql/lib/protocol/Parser.js:73:12)
  2017-06-27T02:09:55.662642+00:00 app[web.1]:     at Protocol.write (/app/node_modules/mysql/lib/protocol/Protocol.js:39:16)
  2017-06-27T02:09:55.662642+00:00 app[web.1]:     at Socket.&lt;anonymous&gt; (/app/node_modules/mysql/lib/Connection.js:96:28)
  2017-06-27T02:09:55.662644+00:00 app[web.1]:     at emitOne (events.js:96:13)
  2017-06-27T02:09:55.662644+00:00 app[web.1]:     at Socket.emit (events.js:188:7)
  2017-06-27T02:09:55.662646+00:00 app[web.1]:     at readableAddChunk (_stream_readable.js:176:18)
  2017-06-27T02:09:55.662646+00:00 app[web.1]:     at Socket.Readable.push (_stream_readable.js:134:10)
  2017-06-27T02:09:55.662648+00:00 app[web.1]:     --------------------
  2017-06-27T02:09:55.662648+00:00 app[web.1]:     at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:141:48)
  2017-06-27T02:09:55.662649+00:00 app[web.1]:     at Connection.query (/app/node_modules/mysql/lib/Connection.js:201:25)
  2017-06-27T02:09:55.662650+00:00 app[web.1]:     at /app/server.js:59:16
  2017-06-27T02:09:55.662650+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
  2017-06-27T02:09:55.662651+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/route.js:131:13)
  2017-06-27T02:09:55.662652+00:00 app[web.1]:     at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
  2017-06-27T02:09:55.662653+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
  2017-06-27T02:09:55.662653+00:00 app[web.1]:     at /app/node_modules/express/lib/router/index.js:277:22
  2017-06-27T02:09:55.662654+00:00 app[web.1]:     at param (/app/node_modules/express/lib/router/index.js:349:14)
  2017-06-27T02:09:55.662654+00:00 app[web.1]:     at param (/app/node_modules/express/lib/router/index.js:365:14)
  2017-06-27T02:09:55.662655+00:00 app[web.1]:   code: 'ER_PARSE_ERROR',
  2017-06-27T02:09:55.662656+00:00 app[web.1]:   errno: 1064,
  2017-06-27T02:09:55.662657+00:00 app[web.1]:   sqlState: '42000',
  2017-06-27T02:09:55.662657+00:00 app[web.1]:   index: 0 }
  </code></pre>
  
  <p>I hope there is a solution for this one.</p>
  
  <p>Many thanks</p>