I defined a variable in a method inside controller e.g.
class test extends CI_Controller {
function tester() {
$variable = 'value'
}
}
Now I want to call this variable in my model. How is that possible?
Edit: I use CodeIgniter.
I defined a variable in a method inside controller e.g.
class test extends CI_Controller {
function tester() {
$variable = 'value'
}
}
Now I want to call this variable in my model. How is that possible?
Edit: I use CodeIgniter.
Model:
class your_model extends CI_Model {
var $variable;
function __construct() {
parent::__construct();
}
function set_variable($variable) {
$this->variable = $variable;
}
}
Controller:
class test extends CI_Controller {
function tester() {
$this->load->model('your_model');
$variable = 'value'
$this->your_model->set_variable($variable);
}
}