Welcome Guest, Not a member yet? Register   Sign In
Message: Undefined property: Mainpage::$3
#1

[eluser]signals107[/eluser]
hi ,
i faced to this error in my project:

Severity: Notice

Message: Undefined property: Mainpage::$3

Filename: core/Model.php

Line Number: 51


what is the fault?
please guide me.
#2

[eluser]Tpojka[/eluser]
What says line 51 in core/Model.php file?
#3

[eluser]signals107[/eluser]
48 : function __get($key)
49: {
50: $CI =& get_instance();
51: return $CI->$key;
52: }
#4

[eluser]CroNiX[/eluser]
The problem is in the Mainpage model, not the base model class. You have a variable/property named $3, which is illegal in php. Variables can't start with a number.
#5

[eluser]signals107[/eluser]
the point is i have not any variable that start with number! i read my files over and over and i did not find any variable such that
#6

[eluser]Tpojka[/eluser]
You are getting some $key. Is it set before in code?
#7

[eluser]signals107[/eluser]
what do you mean?
#8

[eluser]CroNiX[/eluser]
We're not going to be able to guess. We need to see the code for the controller/method that is calling your mainpage model, as well as the model itself.
#9

[eluser]signals107[/eluser]
this is my controller/mainpage.php:

<?php

class Mainpage extends CI_Controller {

public function _construct(){

parent::_construct();
}

public function index($page='mainpage'){

if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')){

show_404();
}

$data['title'] = ucfirst($page);

$this->load->view('Templates/header',$data);
$this->load->view('pages/'.$page,$data);

}

public function login_user(){

$this->load->helper('form');
$this->load->library('form_validation');

$this->form_validation->set_rules('username','Username','required|callback_check_valid|trim');
$this->form_validation->set_rules('password','Password','required|callback_check_valid|trim');

if($this->form_validation->run()===FALSE){
$data['title'] = ucfirst('mainpage');
$this->load->view('Templates/header',$data);
$this->load->view('pages/mainpage.php',$data);
return true;

}
// call model function
$this->load->model('user_model');
$bool=$this->user_model->login();
if($bool===true){
echo "you are login!";
return true;
//redirect('page after login');// show main page
}
else{
$data['title'] = ucfirst('mainpage');
$this->load->view('Templates/header',$data);
$this->load->view('pages/mainpage.php',$data);
echo "your username or password is wrong!";
return false;
}

}

function check_valid($s){

$this->load->helper('string');
$s=strip_quotes($s);
$s=trim_slashes($s);
return true;

}
}




Theme © iAndrew 2016 - Forum software by © MyBB