public static function allValues($valueKey, $query, $parameters = [], $errorHandler = null)
    {
        // execute query
        $result = static::query($query, $parameters, $errorHandler);

        $records = [];
        while ($record = $result->fetch(PDO::FETCH_ASSOC)) {
            $records[] = $record[$valueKey];
        }

        return $records;
    }
public static function allValues($valueKey, $query, $parameters = [], $errorHandler = null)
    {
        // execute query
        $result = static::query($query, $parameters, $errorHandler);

        $records = [];
        while ($record = $result->fetch(PDO::FETCH_ASSOC)) {
            $records[] = $record[$valueKey];
        }

        return $records;
    }
public static function allValues ( $ valueKey , $ query , $ parameters = [ ] , $ errorHandler = null ) { // execute query $ result = static :: query ( $ query , $ parameters , $ errorHandler ) ; $ records = [ ] ; while ( $ record = $ result -> fetch ( PDO :: FETCH_ASSOC ) ) { $ records [ ] = $ record [ $ valueKey ] ; } return $ records ; }
Gets you some column from every record.

@param string $valueKey The name of the column you want.
@param string $query A MySQL query
@param array|string $parameters Optional parameters for vsprintf (array) or sprintf (string) to use for formatting the query.
@param callable $errorHandler A callback that will run in the event of an error instead of static::handleError
@return array The column provided in $valueKey from each found record combined as an array. Will be an empty array if no records are found.
Gets you some column from every record .