getMedian

Syntax
 mixed getMedian {
       mixed string $table
       mixed string $column
       optional mixed string $where
}

Returns the median value of $column for $table, or false if an error occurs.

The $where clause is optional, but if used, the WHERE statement must include the requested column as in “WHERE name > 'A'”. If an error occurs, false is returned.


Usage

/*
 * Assumed database connection in $db
*/
$table = 'zip_codes';
$column = 'population';
 
$medianPopulation = $db->getMedian($table,$column);