title: getting list of users in Drupal 7 using PHP
body: <p>How can I fetch user names from a Drupal 7 database using PHP?</p>
  
  <p>See this:
  <a href="https://stackoverflow.com/questions/1183158/is-it-possible-to-use-the-drupal-api-to-get-a-list-of-users">Is it possible to use the Drupal api to get a list of users?</a></p>
  
  <p>This is for Drupal 6 and I have tried this but it says </p>
  
  <pre><code>Call to undefined function db_fetch_object()
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>$result = db_query("SELECT name AS users_name FROM {users}");
  while($row = db_fetch_object($result)) {    
          print_r($row);      
  }
  </code></pre>