title: How to insert values into Mysql.js table in Node express project
body: <p>This is my use case.</p>
  
  <ol>
  <li>First I insert data to the customer table.</li>
  <li>Then I get the insertId for the customer.</li>
  <li>Then I try to insert data into address table using that id.</li>
  </ol>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>async function createCustomer(req, res, next) {
      const customer = {
          type: req.body.type,
          first_name: req.body.first_name,
          last_name: req.body.last_name,
          email: req.body.email
      };
      
      const first_line = req.body.first_line
  
      console.log("Customer from front-end", customer);
  
      try {
          let query1 = "INSERT INTO customer_supplier SET ?";
          connection.query(query1, customer, (error, results) =&gt; {
              if (error) {
                  console.log("Error", error);
              } else {
                  let userId = results.insertId;
                  let query2 = "INSERT INTO address (id,first_line) VALUES ?";
  
  
                  connection.query(query2, [userId, first_line], (error, results) =&gt; {
                      if (error) {
                          console.log("error in address ==================================", error)
  
                      } else {
                          res.json({
                              results: results
                          })
                      }
                  })
              }
          });
  
        
      } catch (error) {
          console.log("error from", error);
          res.json({
              error: error
          });
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>But when I try to insert data into the address table,</p>
  
  <pre><code>code: 'ER_PARSE_ERROR',
    errno: 1064,
    sqlMessage: '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 \'36\' at line 1',
    sqlState: '42000',
    index: 0,
    sql: 'INSERT INTO address (id,first_line) VALUES 36' }
  </code></pre>
  
  <p>Before put this question on stackoverflow I tried so many variations in my insert statement and nothing works for me.
  How do I achieve this?</p>