title: Access looping value inside callback function
body: <p>Am trying to access the value of 'i' in the db query below but unfortunately, because the result of the query is one, am only getting the first value of the looping instead of getting the entire looping values. Any help. Thanks</p>
  
  <pre><code>for (var i = 0; i &lt; 5; i++) {
        db('student_balance').where({'student_number':student_number}).then(function(pfb_row){
           for (var b = 0; b &lt; pfb_row.length; b++) {
                pfb_row[b];
               }
          console.log(i)
         });
      }
  </code></pre>