a) you can execute the 'select' ( SELECT count(*) FROM table_name ) in phpmyadmin, it should return 1 value
b) you can execute the following code ( only added a few debug prints )
<?php
$link = mysqli_connect("host", "username", "password","db_name");
echo "connect error: ".mysqli_error($link)."<br>\n";
$result = mysqli_query($link, "SELECT count(*) FROM table_name");
echo "query error: ".mysqli_error($link)."<br>\n";
$num_rows = mysqli_fetch_row($result)[0];
echo "fetch_row error: ".mysqli_error($link)."<br>\n";
echo "table_name rows: $num_rows<br>\n";
?>
P.S.
insert appropriate values for host, username, password, db_name and table_name