title: Issue Dynamically Populating Dropdown Using Node and Handlebars
body: <p>I am attempting to dynamically populate the dropdown on my template. I am adding company IDs to an array and then attempting to pass the array to the template.</p>
  
  <p>Adding the IDs to the array:</p>
  
  <pre><code>var express = require('express');
  //var mysql = require('./dbcon.js');
  
  
  var mysql = require('mysql');
  var pool = mysql.createPool({
    connectionLimit : 10,
    host  : 'localhost',
    user  : 'root',
    password: 'Baseball247!',
    database: 'award'
  });
  
  
  var app = express();
  var handlebars = require('express-handlebars').create({defaultLayout:'main'});
  
  app.engine('handlebars', handlebars.engine);
  app.set('view engine', 'handlebars');
  app.set('port', 3000);
  app.use(express.static('public'));
  app.get('/add-user', function(req,res){
    var context = {};
    pool.query("SELECT id from company;", function(err,rows,fields){
      if (err){
        console.log(err);
        next(err);
        return;
      }
      context.results = rows;
      var companies = [];
      //console.log('The solution is: ', rows.length);
      for (var i =0; i &lt; rows.length; i++) {
        //console.log('The solution is: ', rows[i]["id"]);
        companies.push(rows[i]["id"]);
      }
      console.log(companies);
      res.render('addUser', {companies : companies});
    });
  });
  </code></pre>
  
  <p>Then, I try to display those values in the dropdown via:</p>
  
  <pre><code>&lt;select&gt;
      &lt;% for(var i=0; i &lt; companies.length; i++) { %&gt;
          &lt;option&gt;&lt;%= companies[i] %&gt;&lt;/option&gt;
      &lt;% } %&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>However, when I look at the web page the dropdown shows this instead of the company IDs:
  <a href="https://i.stack.imgur.com/U34dM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U34dM.png" alt="enter image description here"></a></p>
  
  <p>When I <code>console.log</code> the array I see the correct results so I assume the issue is either with how I am passing the array or how I am traversing/calling the array in the template. Does anyone know what I am missing here?</p>