What is the most efficient way to get the number of rows from a table? I'm able to do it with the following code, but looping through a recordset of one row seems inefficient. Is there a better way to do this?
<?php
$con=mysqli_connect("0000000000","0000000000","0000000000","0000000000");
$sql = 'SELECT count(*) AS t FROM count';
$result = mysqli_query($con,$sql);
while ($row = mysqli_fetch_assoc($result)) {
echo $row['t']';
}
mysqli_close($con);
?>