title: mysql_num_rows() returning 0
body: <p>My $result variable will equal to "Resource id #4" when program executes. 
   Which clearly means that my mysql_query() was successfully executed.
   But when I call in mysql_num_rows($result), I always get back 0. Although a row does exist, I keep getting a value of 0. Why?</p>
  
  <pre><code>if (isset($_POST["user"]) &amp;&amp; isset($_POST["pass"]))
  {
      // prepare SQL
      $sql = sprintf("SELECT 1 FROM users WHERE username='%s' AND password=PASSWORD('%s')",
                     mysql_real_escape_string($_POST["user"]),
                     mysql_real_escape_string($_POST["pass"]));
  
      // execute query
      $result = mysql_query($sql);
  
  
      if ($result === false)
          die("Could not query database");
  
  
      $numOfRows = mysql_num_rows($result);
  </code></pre>