sql count in php 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: count sql query in php
$sql = "SELECT COUNT(*) AS total from Members";
$result = $conn->query($sql);
$data = $result->fetch_assoc();
echo $data['total'];