protected $_table_name = $this->session->userdata('table_name');
This my code while am trying to assign session data to this var , it shows error.
Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\Code\application\models\addfilters_m.php on line 4
like this and here i have attached my whole model page
<?php
class addfilters_m extends MY_Model
{
protected $_table_name = $this->session->userdata('table_name');
protected $_order_by = 'id';
public $rules = array(
'title' => array(
'field' => 'title',
'label' => 'Title',
'rules' => 'trim|required|max_length[100]|xss_clean'
),
'slug' => array(
'field' => 'slug',
'label' => 'Slug',
'rules' => 'trim|required|max_length[100]|url_title|callback__unique_slug|xss_clean'
),
'body' => array(
'field' => 'body',
'label' => 'Body',
'rules' => 'trim|required'
)
);
public function get_new ()
{
$addfilters = new stdClass();
$addfilters->title = '';
$addfilters->slug = '';
$addfilters->body = '';
return $addfilters;
}
}
Use this approach which should be helpful to you and solve the issue.
protected $_table_name;
public function __construct()
{
$this->_table_name= $this->session->userdata("table_name");
parent::__construct();
}