[eluser]geshan[/eluser]
I'm coding a code igniter library, for pagination I need to make the total_rows variable global(accessible in all the functions of the library). I can't set the variables thought they are set to var xyz just after class { start. I can set them from the constructor but can't set them from other functions, how can I do it? Are there any specials ways to do that except $this->global_var= $any_var;
Code:
class Testlib{
var $output=;
var $settings;
var $total_rows;
function Testlib($params){
$this->total_rows=15;// it works
$this->total_rows=$param['total_rows'];//also works
}//constructor close
function setTotalRows(){
$this->total_rows=25; //does not work
//even the code below does not work...
$query_res['no_of_rows']=$query_exe->num_rows();
$this->total_rows=$query_res['no_of_rows'];
}//function setTotalRows close
}//class close
How can I do it, or is it happening due to the page reload? suggest and help.