title: How to save the result of MySql query in variable using node-mysql
body: <p>im trying to save the result of MySql query in variable using node-mysql model and node.js so i have this code:</p>
  
  <pre><code>connection.query("select * from ROOMS", function(err, rows){
  if(err) {
      throw err;
  } else {
      console.log(rows);
  }
  });
  </code></pre>
  
  <p>and the result is :</p>
  
  <pre><code>[ { idRooms: 1, Room_Name: 'dd' },
    { idRooms: 2, Room_Name: 'sad' } ]
  </code></pre>
  
  <p>so i need to store this results in variable so i try like this:</p>
  
  <pre><code> var someVar = connection.query("select * from ROOMS", function(err, rows){
  if(err) {
      throw err;
  } else {
      return rows;
  }
  });
  
  console.log(someVar);   
  </code></pre>
  
  <p>but is not working thanks for any help in advance.</p>