title: setInterval in loop nodejs
body: <p>I know that there are other questions just like this but my code just doesnt seems to work.
  Could you have a look at my code and tell me where i am wrong.   </p>
  
  <pre><code> var mysql = require('mysql');
  
  var client = mysql.createClient({
    user: 'jed',
    password: 'jed8703',
    host: 'localhost',
    database: 'jedtest'
  });
  
  //var query = client.query(
  //  'INSERT INTO testtable '+
  //  'SET testid = ?, name = ?, value = ?',
  //  [1, 'test', 'test']
  //);
  
  
  client.query(
    'SELECT * FROM testtable',
    function selectCb(err, results, fields) {
      if (err) {
        throw err;
      }
  
      console.log(results[0].Name);
      for(var i in results)
          {
              (function(y)
              {
                  setInterval(function() {
                    console.log(results[y].Name + 'value:' + results[y].Value );
                  }, 5000 );
              })
          }
    }
  );
  
  client.end();
  </code></pre>