title: mysql count into PHP variable
body: <p>Let say that we have the following query:</p>
  
  <pre><code>SELECT DISTINCT COUNT(`users_id`) FROM `users_table`;
  </code></pre>
  
  <p>this query will return the number of the users from a table. I need to pass this value to a PHP variable. I'm using this:</p>
  
  <pre><code>$sql_result = mysql_query($the_query_from_above) or die(mysql_error());
  
  if($sql_result)
  {
      $nr_of_users = mysql_fetch_array($sql_result);
  }
  else
  {
      $nr_of_users = 0;
  }
  </code></pre>
  
  <p>please correct my code where you think is necessary. </p>
  
  <p>Which is the best approach. How do you recommend to do this ?</p>