I just don't want to have such a duplicate function in a model, however I need to use that function again with a little change in it.
The little change is:
In the $first->get->model
, I need to pass a segment url such as 'where id = $this->uri->segment(3)
',
However, in the $second->get->model
, I don't have that segment url anymore but have already save it to a session.
For example: (Please have a look to this code)
function get_regidsterLogin($limit, $offset) //There is no problem with $limit and $offset
{
$this->load->database();
$this->db->select(' ds.userid,
ds.register_time,
gl.logintime
');
$this->db->from('data_stats ds');
$this->db->join('game_login gl', 'gl.data_id = ds.dataid', 'inner');
//Here is what I want to change with session that I will send from view or maybe controller
$this->db->where('DATE(register_time)', $this->uri->segment(3));
$this->db->limit($limit, $offset);
$query = $this->db->get();
if($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
$data[] = $row;
}
return $data;
}
}
Is there a simple smart way to do this?
Thanks in advance.