Basecoat\DB::fetch PHP Method

fetch() public method

Fetch one row of data from the database after SELECT query is run
public fetch ( boolean $useMaster = false, constant $method = null ) : array
$useMaster boolean set to TRUE to use the master server connection
$method constant PDO method to use for fetch records (default is PDO::FETCH_ASSOC)
return array associative array of database record
    public function fetch($useMaster = false, $method = null)
    {
        if ($useMaster) {
            $sth =& self::$msth;
        } else {
            $sth =& $this->sth;
        }
        if (!is_object($sth)) {
            $this->errorCode = 'n/a';
            $this->errorMsg = 'Statement handle is not an object.';
            return -1;
        }
        if (is_null($method)) {
            $method = \PDO::FETCH_ASSOC;
        }
        return $sth->fetch($method);
    }