title: Count registered users in database
body: <p>I would like to echo the number of people registered on my website
  only the code that I have does not work, it gives me back that it can't be
  converted to string. Also when I make it a function to call in my HTML I get error that $connection is undefined</p>
  <pre><code>require_once(&quot;connect.php&quot;);
  
  $sql = &quot;SELECT * FROM persons&quot;;
  if ($result=mysqli_query($connection, $sql)){
  $rowcount = mysqli_num_rows($result);
  mysqli_free_result($result);
  return $result;}
  </code></pre>
  <p>How do I get this in a function that I can call on my page that prints the number of people registered?</p>