count in php mysql code example
Example 1: get count sql query in php
$result=mysql_query("SELECT count(*) as total from Students");
$data=mysql_fetch_assoc($result);
echo $data['total'];
Example 2: select count from table mysql
SELECT COUNT(*) FROM count_demos;
Example 3: count sql query in php
$sql = "SELECT COUNT(*) AS total from Members";
$result = $conn->query($sql);
$data = $result->fetch_assoc();
echo $data['total'];