title: How to solve? ER_BAD_FIELD_ERROR: Unknown column 'undefined' in 'field list'
body: <p>I am trying to insert form data into MySQL database in nodejs using expressjs</p>
  
  <p>When I run my code in command prompt it ran well but when I press the submit button, I got the following errors:</p>
  
  <pre><code>var connection = mysql.createConnection({
    host     : 'localhost',
    user     : 'root',
    password:'',
    database : 'test'
  });
  
  app.get("/", function(req, res){
          res.render("home");
  });
  
  //when I press submit button it should post the request and render a page to submit route with text "data saved!!" 
  
  app.post("/submit", function(req, res){
  
    var q = "Insert into test (ID, name, crash1, crash2, crash3) VALUES (null, '" + req.body.ANR + "', " + req.body.crash1 + ", " + req.body.crash2 + ", " + req.body.crash3 +")";
    connection.query(q, function(err){
        if(err) throw err
        res.render("home", {message: 'data saved!!'});
    })
  });
  </code></pre>
  
  <p>I created a table in MySQL Command line</p>
  
  <pre><code>create table xyz(
      ID BIGINT AUTO_INCREMENT PRIMARY KEY NOT NULL, 
      name VARCHAR(100) NOT NULL, 
      crash1 BIGINT, 
      crash2 BIGINT, 
      crash3 BIGINT
  );
  </code></pre>
  
  <p>when I inserted manually it worked!</p>
  
  <pre><code>insert into xyz(ID, name, crash1, crash2, crash3) VALUES (1,'REERE', 2 ,2 ,2);
  </code></pre>
  
  <p>my error looks like this
  <a href="https://i.stack.imgur.com/nUCQU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nUCQU.png" alt="enter image description here"></a></p>