I am having a if loop like this:
if(!empty($all_msg_e))
{ print_r($all_msg_e);
        foreach($all_msg_e as $ae)
        {
            echo $ae['msg_desc']."<br>";
            display($ae['msg_id']);
        }
}
and the function display() is :
function display($msg_id,$obj)
{
    
    $this->db->select("*");
    $this->db->from("et_msg");
    $this->db->where("link_to",$msg_id);
    $child_msg=$this->db->get()->result_array();
    
    print_r($child_msg);die;
        echo $child_msg['msg_desc']."<br>";
        echo $child_msg['msg_id']."<br>";
        $msg_id=$child_msg['msg_id']."<br>";    
    
    display($msg_id);
}
here I was getting error: Using $this when not in object context
then referencing this answer I replaced $this with any variable $obj
$obj->db->select("*");
    $obj->db->from("et_msg");
    $obj->db->where("link_to",$msg_id);
    $query = $obj->db->get();
then it started giving error like:Call to a member function select() on a non-object
The concept behinde all this is: I am having table named "et_msg" and in that several message between two person are being stored. The conversation is linked by storing one message's id to another messages' "link_to" field. And I want to display the conversation one after another manner
Whats wrong is being done?? Completely Stuck..
P.S. I am using CodeIgniter for the same
 
    