我在数据库中具有相同的first_name列名,并且具有不同的user_type如何在站点的两个不同列中分隔显示

i am fresher, i have one table in database with table name of'teams' i want first_name with user_type 3 and user_type 4 separated like that first_name jon,roy with user_type 3 first_name robert,sina with user_type 4

now my problem is that there is column name is same i am unable to separate by user_type these values because of same column name (first_name)

My Database table name 'teams'

-------------------------------------
id    |  first_name    |   user_type
-------------------------------------
1        jon              3
2        roy              3
3        robert           4
4        sina             4
-------------------------------------

this is my code

model

       public function fetch_team() {
            $this->db->select('team.*');
            $this->db->from('team');
           $where = '(user.user_type="3" or user.user_type = "4")';
           $this->db->where($where);
           $query = $this->db->get();
            $result = $query->result_array();
            return $result;
        }

controller

        $value = $this->Querydata->fetch_team();
        $data['data']['teams'] = $value;

view

     <?php foreach ($data['teams'] as $key => $value) { ?>
     <tr>
      <td><input type="checkbox" id="<?php echo $value['team_id']; ?>" class="flat team_list multiple_delete"></td>

      <td><?php echo $value['id']; ?></td>
      <td><?php echo $value['first_name']; ?></td> // for user_type 3
<td><?php echo $value['first_name']; ?></td>  // for user_type 4 
    </tr>
    <? php }?>

problem statement

// for user_type 3 // for user_type 4 there at a time one $value['first_name']; ?> // for user_type 3 show another hide vise-versa

you have to check each row in your foreach statement if its user_type 3 or 4:

Try this

<?php if($value['user_type']=3) { echo "<td>".$value['first_name'].</td>"; } else { echo "<td></td>"; }?> // for user_type 3
<?php if($value['user_type']=4) { echo "<td>".$value['first_name'].</td>"; } else { echo "<td></td>"; }?> // for user_type 4

The 'if' statement checks the user type and write the name of an empty <td></td>.