title: How to get count of rows in MySQL table using PHP?
body: <p>I simply want to use PHP to get a count of the total number of rows in a MySQL table, and store the number in a variable called <code>$count</code>.</p>
  
  <p>I prefer procedural code since my mind doesn't work in object-oriented fashion.</p>
  
  <pre><code>$sql="SELECT COUNT(*) FROM news";
  $result = mysqli_query($con, $sql);
  $count = mysqli_fetch_assoc($result);
  echo $count;
  </code></pre>
  
  <p>The above is the latest I tried. Instead of giving me a number, it gives me the word "Array".</p>