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

        // get record
        $record = $result->fetch(PDO::FETCH_ASSOC);

        // return record
        return $record;
    }
public static function oneRecord($query, $parameters = [], $errorHandler = null)
    {
        // preprocess and execute query
        $result = static::query($query, $parameters, $errorHandler);

        // get record
        $record = $result->fetch(PDO::FETCH_ASSOC);

        // return record
        return $record;
    }
public static function oneRecord ( $ query , $ parameters = [ ] , $ errorHandler = null ) { // preprocess and execute query $ result = static :: query ( $ query , $ parameters , $ errorHandler ) ; // get record $ record = $ result -> fetch ( PDO :: FETCH_ASSOC ) ; // return record return $ record ; }
Returns the first database record from a query.

It is recommended that you LIMIT 1 any records you want out of this to avoid having the database doing any work.

@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 Result from query or an empty array if nothing found.
Returns the first database record from a query .