CodeIgniter Forums

Full Version: Update code from ci 1.6 to ci 2.0 getting error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

function _set_fields(){
        $fields['id'] = 'id';
        $fields['name'] = 'name';
        $fields['gender'] = 'gender';
        $fields['dob'] = 'dob';


    // validation rules
    function _set_rules(){
        $rules['name'] = 'trim|required';
        $rules['gender'] = 'trim|required';
        $rules['dob'] = 'trim|required|callback_valid_date';


        $this->validation->set_message('required', '* required');
        $this->validation->set_message('isset', '* required');
        $this->validation->set_error_delimiters('<p class="error">', '</p>');

and give this error:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Person::$validation

Filename: controllers/person.php

Line Number: 168

Fatal error: Call to a member function set_fields() on a non-object in C:\wamp\www\bebas\application\controllers\person.php on line 168

what's wrong with that code?

El Forum

The Validation library is depreciated and replaced by the Form_Validation library