title: get the number of rows - mysqli
body: <p>I am trying this code but i want to know what is the number of results of this query. If do the same query in mysql console I get 4 results, but with this code I get 0 rows. 
  What is the correct way to get the number of rows ?  </p>
  
  <pre><code> function check_oferta_existe($db, $id, $id_oferta) {
              $sql = $db -&gt; prepare("
              SELECT COUNT(offer)
              FROM offer
              WHERE company_users_id_user1 = ? AND offer = ? AND state = 0
              ");
  
              $sql -&gt; bind_param('is', $id, $oferta);
              $sql -&gt; execute();
              $sql -&gt; fetch();
              $sql-&gt;store_result();
              $rows = $sql-&gt;num_rows;
  
              var_dump($rows); // 0, should be 4
              if ($rows == 1) {
                  return true;
              }
              else {
                  return false;
              };
          }
  </code></pre>