如何从模态连接连接值

i ve different scenario compare to rest posts. I ve two tables such as:

subscription

enter image description here

and categoryenter image description here

Now the columns Fruits,Snack,Sauce,lunch in subsscription r the id of category table. for example if Fruits is 1 then from category table that Fruit name is Apple.I want to get the names of those foods whose ids are listed in subscription table from category table column: itemname.

I m working on codeigniter and tried by using joins but i dont see any values.

$this->db->select('*');
        $this->db->from('subsscription');
        $this->db->join('addschool','addschool.id=subsscription.schoolid');
        $this->db->join('user','user.id=subsscription.studentid');
        $this->db->join('category As u1','u1.id=subsscription.Fruits', 'left OUTER');

         $this->db->join('category As u2','u2.id=subsscription.snack', 'left OUTER');
         // $this->db->where('subsscription.snack >', '0');
        $this->db->join('category As u3','u3.id=subsscription.sauce', 'left OUTER');

         $this->db->join('category As u4','u4.id=subsscription.lunchdrink', 'left OUTER');

        $this->db->join('category As u5','u5.id=subsscription.icypole', 'left OUTER');

        $this->db->join('category As u6','u6.id=subsscription.lunch', 'left OUTER');
        // $this->db->where('subsscription.Fruits','category.id');
         // $this->db->group_by('subsscription.id');


        $query = $this->db->get();

        //echo $this->db->last_query();

        if($query->num_rows() > 0)
        {
            return $query->result();
        }
        else
        {
            return false;
        }

My output requirement is that it should be like: Apple,Strawberry Milk where Apple has row id is 1 and Strawberry Milk has row id is 4.

I can't make it work by doing SELECT('*'). I could be wrong, it happens more often than not, but I don't think you can do that. The following worked for me. If someone else has an answer that actually does just grab everything in all of the tables, please feel free to add it.

I also left the school table out, so you'll have to work it back in. I created the tables with the pertinent information and didn't feel like making that one.

    $this->db->select('subsscription.id AS sub_id, user.name, u1.itemname AS fruit, u2.itemname AS snack, u3.itemname AS sauce, u4.itemname AS lunchdrink, u5.itemname AS icypole, u5.itemname AS lunch');
    $this->db->from('subsscription');
    $this->db->join('user','user.id=subsscription.studentid', 'JOIN');
    $this->db->join('category As u1','subsscription.Fruits=u1.id', 'LEFT OUTER');
    $this->db->join('category As u2','subsscription.snack=u2.id', 'LEFT OUTER');
    $this->db->join('category As u3','subsscription.sauce=u3.id', 'LEFT OUTER');
    $this->db->join('category As u4','subsscription.lunchdrink=u4.id', 'LEFT OUTER');
    $this->db->join('category As u5','subsscription.icypole=u5.id', 'LEFT OUTER');
    $this->db->join('category As u6','subsscription.lunch=u6.id', 'LEFT OUTER');
    $query = $this->db->get();
    if($query->num_rows() > 0) {
        foreach($query->result() AS $row) {
            print '<pre>' . print_r($row, TRUE) . '</pre>';
        }
    }

The output of this was:

stdClass Object
(
    [sub_id] => 1
    [name] => Betty
    [fruit] => Apple
    [snack] => 
    [sauce] => 
    [lunchdrink] => Strawberry Milk
    [icypole] => 
    [lunch] => 
)
stdClass Object
(
    [sub_id] => 2
    [name] => John
    [fruit] => Banana Bread
    [snack] => 
    [sauce] => Apple
    [lunchdrink] => 
    [icypole] => Strawberry Milk
    [lunch] => Strawberry Milk
)

I obviously used random values.