How can the Row Count of a ResultSet be utilized in PHP to iterate over records without using COUNT(*)?

To iterate over records in a ResultSet without using COUNT(*), you can utilize the row count of the ResultSet to determine the number of records. This can be achieved by fetching the row count using the mysqli_num_rows() function in PHP. You can then use a loop to iterate over the records based on the row count.

// Assuming $result is the ResultSet obtained from a query execution

$row_count = mysqli_num_rows($result);

if ($row_count > 0) {
    while ($row = mysqli_fetch_assoc($result)) {
        // Process each record here
    }
} else {
    echo "No records found.";
}