• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Update code from ci 1.6 to ci 2.0 getting error

#1
[eluser]Unknown[/eluser]
Code:
function _set_fields(){
        $fields['id'] = 'id';
        $fields['name'] = 'name';
        $fields['gender'] = 'gender';
        $fields['dob'] = 'dob';

        $this->validation->set_fields($fields);
    }

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

        $this->validation->set_rules($rules);

        $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?

#2
[eluser]n0xie[/eluser]
The Validation library is depreciated and replaced by the Form_Validation library


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.