title: TypeError: cb is not a function - with callback
body: <p>I am trying to get a list of users from a database and when this has completed I want to list these users. I have tried to use a callback but getting the error that <code>TypeError: cb is not a function</code> </p>
  
  <pre><code>var getAllUsers = function(users) {
      console.log(users)
  }
  
  function checkForUsers(table, cb) {
      connection.query('SELECT * from ' + table, function(err, rows, fields) {
          if(err) console.log(err);
          for(var i = 0; i &lt; rows.length; i++) {
              users.push({id: id});   
              if(i == (rows.length - 1)) {
                  cb(users)
              } 
          }
      });
  }
  
  checkForUsers('users',getAllUsers(users));
  </code></pre>