I know this question already has answers but I did not understand so asked again So please help.
What does this error actually mean ?
Fatal error: Using $this when not in object context in C:\wamp\www\provisioning\application\controllers\customer\provisioning.php on line 27
public function index(){
$users = $this->data['tenant_users'] = $this->customer_user_m->tenant_users();
$domain = $users[0]['domain'];
$site = $users[0]['site_key'];
$tenant_id = $users[0]['tenant_id'];
$site = $this->session->userdata('site');
$user_table = $this->session->userdata('user_table');
function getOTAURLExt($ext){
var_dump($this);
}
function getOTAURLSite(){
echo "Site executed";
}
$this->db->select('*');
$this->db->where('id', $tenant_id);
$this->db->from('tenant');
$query = $this->db->get();
$result = $query->result_array();
if(empty($this->input->post('md'))){
$URL = getOTAURLSite($site);
}else{
$username = $result[0]['username'];
$table_user = $username . "_users";
$this->db->select('*');
$this->db->where($table_user . '.site_key', $site);
$this->db->join('mlcsites', 'mlcsites.site_key =' . $table_user . '.site_key');
$this->db->from($table_user);
$query_table = $this->db->get();
$information = $query_table->result_array();
$ext = $information[0]['ext'];
$count = count($information);
$found = false;
for($i = 0; $i < $count; $i++){
$domain = $information[$i]['domain'];
$ext = $information[$i]['ext'];
$hash = do_hash($ext . "@" . $domain, 'md5');
if($hash == $this->input->post('md')){
$found = true;
break;
}
}
if($found == true){
$URL = getOTAURLExt($ext);
}
}
if(empty($URL)){
}
$this->data['subview'] = 'provisioning/index';
$this->load->view('_layout_main', $this->data);
}
What could be the possible solution to this?
As per the code that you provided, there seems to be nothing on "line 27" so IMHO it seems to be caused on "line 10"
function getOTAURLExt($ext){
var_dump($this); // <<< This seems to be causing error.
}
Now If you need the variable $this
inside the function you could either
...then use it inside the function.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments