[eluser]anndr0id[/eluser]
I searched the forums and couldn't find any solution to this issue.
The error I'm receiving is thus:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: User_model::$get_countries
Filename: users/register.php
Line Number: 13
LAMP environment, PHP5, Most recent version of CodeIgniter
I've tried calling the model from both the construct and the function, and get the same error, always at line 13 which is:
Code:
$countries = $this->userdb->get_countries;
I've tried calling the database in different ways, not renaming the model, etc. with no success.
Code is as follows for register.php controller:
Code:
class Register extends Controller {
function __construct() {
parent::Controller();
$this->load->model('User_model', 'userdb', TRUE);
}
function index() {
//create the country dropdown
$countries = $this->userdb->get_countries; // THIS IS LINE 13
foreach ($countries as $row) {
$data['countrySelect'] .= '<option value="'.$row->ID.'" '. set_select('country', $row->ID). '>'.$row->name.'</option>';
}
//load view
$this->load->view('users/register_view', $data);
}
}
and this is the model with offending function:
Code:
class User_model extends Model {
function User_model() {
parent::Model();
}
//get country menu
function get_countries() {
$query = $this->db->get('country');
return $query->result();
}
}
I'm stumped. Any clues? Thanks in advance for your insight