i am new to codigniter...
i fetch records from db and want to access it in another functio in same class but it giving me error.. any idea...

class Usercp_Task extends CI_Controller {
    var $cate=array();
    public function index() {
    public fun getCategoryDetails()
         $array_db=result form database...
    public fun showcategory()


In CI you should use a model to do this kind of tasks, but you can pack the result to a string and return that, just use true as third parameter in $this->load->view :

$string = $this->load->view('my_view',$data,true);

A full example would be:

public function test()
    $data['a'] = 'hello world!';
    $string = $this->load->view('first_view',$data,true);
    return $string;
public function hello()
    $data['read'] = $this->test();

Bye :)