title: How to count the number of rows in database table using MySQLi Object-oriented
body: <p>This is my code:</p>
  
  <pre><code>$sql = "SELECT count name_id, name FROM TABLE WHERE tag1 in ('$tag1') OR tag2 in ('$tag1') $andor tag2 in ('$tag2') OR tag1 in ('$tag2') ORDER BY rating desc LIMIT 5 OFFSET 0";
  $result = $conn-&gt;query($sql);
  </code></pre>
  
  <p>And now, I want to echo the number of name_id. So, what to do?</p>
  
  <p>Make new line something like this: <code>$sql = "SELECT count(name_id)</code></p>
  
  <pre><code>echo $sql;
  </code></pre>