Welcome Guest, Not a member yet? Register   Sign In
CI2 - Class 'Model' not found....
#1

[eluser]Gurrewe[/eluser]
Hello!

My error:

Code:
Fatal error: Class 'Model' not found in /home/a5860660/public_html/granden/application/models/auth_model.php on line 3

models/auth_model.php:

Code:
<?php

class Auth_model extends Model {

    function validate()
    {
        $this->db->where('username', $this->input->post('username'));
        $this->db->where('password', $this->input->post('password'));
        $query = $this->db->get('users');
        
        if($query->num_rows == 1)
        {
            return true;
        }
        
    }
    
    function create_member()
    {
        $birthday_array = array($this->input->post('birth_year'),$this->input->post('birth_month'),$this->input->post('birth_day'));
        $birthday = implode(",",$birthday_array);
        
        $new_member_insert_data = array(
            'username' => $this->input->post('username'),
            'password' => $this->input->post('password'),
            'city' => $this->input->post('city'),
            'email' => $this->input->post('email'),
            'name_first' => $this->input->post('name_first'),
            'name_last' => $this->input->post('name_last'),
            'birth' => $birthday                    
        );
        
        
        $this->form_validation->set_rules('name_first', 'Name', 'trim|required');
        $this->form_validation->set_rules('name_last', 'Last Name', 'trim|required');
        $this->form_validation->set_rules('city', 'Stad', 'trim|required');
        $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');
        $this->form_validation->set_rules('birth_year', 'Födelse år', 'trim|required|min_length[4]|max_length[4]');
        $this->form_validation->set_rules('birth_month', 'Födelse månad', 'trim|required|min_length[2]|max_length[2]');
        $this->form_validation->set_rules('birth_day', 'Födelse dag', 'trim|required|min_length[2]|max_length[2]');
        $this->form_validation->set_rules('username', 'Användarnamn', 'trim|required|min_length[4]|max_length[32]');
        $this->form_validation->set_rules('password', 'Lösenord', 'trim|required|min_length[4]|max_length[32]');
        $this->form_validation->set_rules('password2', 'Lösenord Konfirmera', 'trim|required|matches[password]');
        
        
        $insert = $this->db->insert('users', $new_member_insert_data);
        return $insert;
    }
}


So what should I do to fix this?
#2

[eluser]Gurrewe[/eluser]
Someone, please help.

Or should I convert back to CI 1.72? :O
#3

[eluser]WanWizard[/eluser]
Read the blog of Phil Sturgeon re migrating to 2.0. Very intresting stuff.

You'll learn that in 2.0, you should not extend 'Model', but 'CI_Model'. Which means modifying the class definition and contructor of all your models.
#4

[eluser]pickupman[/eluser]
Here's the [url="http://www.philsturgeon.co.uk/news/2010/05/upgrading-to-codeigniter-2.0"]link[/url]. I used by IDE to due a find and replace on my entire project (models). Took about 10 secs or less. The whole process is pretty simple with Phil's instructions.




Theme © iAndrew 2016 - Forum software by © MyBB