Skip to content
bonsak edited this page Nov 20, 2012 · 1 revision

total()

Fetch the total row count returned by the last call to find(), based on the 'limit' parameter set. This is different than the total number of rows found in the database, which you can get with total_found().

public function total ()

Returns

(int) Number of rows returned by find(), based on the 'limit' parameter set

Example

<?php
    // Pod is 'rabbits' Pod and it has 8 records

    // Let's get 3 items ordered by name
    $params = array(
        'limit'   => 3,
        'orderby' => 't.name'
    );

    $rabbits = pods( 'rabbits', $params );
?>

total_found(): <?php echo $rabbits->total_found(); ?>
total(): <?php echo $rabbits->total(); ?>
The above example will output:
total_found(): 8
total(): 3

Available Since Version

2.0+

Source File

total() is located in /pods/classes/Pods.php

See Also