title: MySQL num_rows Returning False Positive
body: <p>I have this query below:</p>
  
  <pre><code>// They have a token and estimate id
  if (isset($_GET['estimate_token']) &amp;&amp; isset($_GET['estimate_id']))
  {
      if ($select = $db -&gt; prepare("SELECT estimate_id FROM estimates WHERE estimate_token =?"))
      {
          $select -&gt; bind_param('s', $_GET['estimate_token']);
          $select -&gt; execute();
          $select -&gt; store_result();
          $select -&gt; bind_result($estimate_id);
          $select -&gt; fetch();
          if ($select -&gt; num_rows == '0')
          {
              header ("Location: ./login.php");
          }else{
          }
          $select -&gt; close();
      }
  }
  </code></pre>
  
  <p>Customers are given a link via email with the token and an estimate id from the database. When they click the link it brings them to the correct estimate. The problem I am having is that if the customers manually replaces the estimate_id or estimate_token with any number in the url it still keeps you on the website where it should kicking you to the login.php. This is bad because it allows customers to view other estimates in the system. </p>
  
  <p>I think the problem lies in the <code>$select -&gt; num_rows</code> throwing a false positive.</p>