title: How to do a petition to a function with mysql
body: <p>I want to do a function that tell me if a user is in my database or not.
  And I cant get the answer.</p>
  
  <p>I tried to do with a function.</p>
  
  <pre><code>function userExist (user) {
      con.query("SELECT * FROM users WHERE name=?", [user], function(err, result) {
          if(err) throw err;
          if(result)
              return true
          else
          return false
      });
  }
  </code></pre>
  
  <p>I expected true/false but the output is undefined.</p>