What potential pitfalls should be considered when using the mysql_num_rows() function in PHP?

When using the mysql_num_rows() function in PHP, it is important to consider that it is deprecated as of PHP 5.5.0 and removed in PHP 7.0.0. It is recommended to use the mysqli_num_rows() or PDOStatement::rowCount() functions instead for better security and compatibility with newer PHP versions.

// Using mysqli_num_rows() function instead of deprecated mysql_num_rows()
$result = mysqli_query($connection, "SELECT * FROM table_name");
$row_count = mysqli_num_rows($result);
echo "Number of rows: " . $row_count;