src/DBConnect.php
public function getFieldValues(string $field_name)
    {
        try {
            $field = [];
            $result = $this->stmt->fetchAll(\PDO::FETCH_ASSOC);
            if (array_key_exists($field_name, $result[0])) {
                foreach ($result as $row) {
                    $field[] = $row[$field_name];
                }
            } else {
                throw new \Exception("Field '$field_name' is not present in the current result set.\n");
            }
            return $field;
        } catch (\PDOException $e) {
            die('Error: ' . $e->getMessage());
        } catch (\Exception $e) {
            die("Error: " . $e->getMessage());
        }
    }
public function getFieldValues(string $field_name)
    {
        try {
            $field = [];
            $result = $this->stmt->fetchAll(\PDO::FETCH_ASSOC);
            if (array_key_exists($field_name, $result[0])) {
                foreach ($result as $row) {
                    $field[] = $row[$field_name];
                }
            } else {
                throw new \Exception("Field '$field_name' is not present in the current result set.\n");
            }
            return $field;
        } catch (\PDOException $e) {
            die('Error: ' . $e->getMessage());
        } catch (\Exception $e) {
            die("Error: " . $e->getMessage());
        }
    }
public function getFieldValues ( string $ field_name ) { try { $ field = [ ] ; $ result = $ this -> stmt -> fetchAll ( \ PDO :: FETCH_ASSOC ) ; if ( array_key_exists ( $ field_name , $ result [ 0 ] ) ) { foreach ( $ result as $ row ) { $ field [ ] = $ row [ $ field_name ] ; } } else { throw new \ Exception ( "Field '$field_name' is not present in the current result set.\n" ) ; } return $ field ; } catch ( \ PDOException $ e ) { die ( 'Error: ' . $ e -> getMessage ( ) ) ; } catch ( \ Exception $ e ) { die ( "Error: " . $ e -> getMessage ( ) ) ; } }
Returns field's values

@param string $field_name    Field's name
@return array                Array with field's values
Returns field s values