mysqli_num_rows()
を使用できます mysqliで
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result))
{
$totalRows++;
echo "<tr>";
echo "<td>" . $row['ID'] ."(".$totalRows. ")</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['imgPURL'] . "</td>";
echo "<td>" . $row['imgUrl'] . "</td>";
echo "</tr>";
}
} else {
echo "<tr><td colspan='4'>Not Found Image:".$line.'</td></tr>';
}