MySQLi Count

MySQLi COUNT is used to return the count of an expression.

Below the syntax of COUNT function.

SELECT COUNT(aggregate_expression) FROM table_name [conditions];
<?php
  $conn  = mysqli_connect('localhost:3306', 'user_name', 'password', 'db_nexladder');
  if(! $conn) {
     die('Could not connect: ' . mysqli_error());
 }
  $sql = "SELECT COUNT(`name`) AS total_name FROM `tbl_employee`";
  $result = mysqli_query($conn, $sql);
  $row = mysqli_fetch_object($result) ;
  echo "Total Name: " . $row->total_name;
  mysqli_close($conn);
?>

Below it'll look like with COUNT Aggregate

mysql count