<?php
$con = mysqli_connect("localhost","root","","test");
if (!$con)
{
die('Could not connect: ' . mysqli_error());
}
$result = mysqli_query("select COUNT(*) FROM table");
$row = mysqli_fetch_array($result);
$total = $row[0];
echo "Total rows: " . $total;
mysqli_close($con);
?>