public function field_by_num($num)
    {
        if (!$this->row) {
            return null;
        }
        
        if (!array_key_exists($num, $this->field_names)) {
            trigger_error("Field with the index $num does not exist in the result set!", E_USER_ERROR);
            return null;
        }
        
        return $this->row[$this->field_names[$num]];
    }