Q:

How to know which field name is of which table in codeigniter php framework

I have joined 3 tables to get information for my page. I need to have name of products but it gave me name of region. Both tables (wiyo_products and wiyo_regions have same filed name 'name').
This is join table code 
function products_sorter($region) {
        $this -> db -> select('*');
        $this -> db -> from('wiyo_products');
        $this -> db -> join('wiyo_products_distribution', 'wiyo_products.id = wiyo_products_distribution.product_id');
        $this -> db -> join('wiyo_regions', 'wiyo_regions.id = wiyo_products_distribution.region_id');
        $this->db->where(array('wiyo_regions.slug'=> $region));

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

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

        }

    }

I have displayed the rows information in search view
<div class="row-fluid" style="margin-top:20px;">
      <?php foreach($products_list as $products_list)
      {
        ?>

        <div class="span3">

            <div class="well">
              <h2><?php echo $products_list->name; ?></h2>

    <p>

        <img src="<?php echo base_url(); ?>app/resources/wiyo/<?php echo $products_list->image; ?>" width="200" />

    </p>
              <p><span class="label">POPULAR</span></p>
              <?php echo $products_list->description; ?>
              <hr>
              <h3 style="text-align: center;">HK$ <?php echo $products_list->price; ?>/day</h3>
              <hr>

              <p style="text-align: center;"><button class="btn btn-info btn-primary"><i class="icon-ok"></i> Select plan</a></button>
                </p>

            </div>

        </div>
      <?php
      }
      //for each loop finished
      ?>

    </div>

How to specify that $products_list->name is for name field of wiyo_products. I am getting name of wiyo_regions. Helping hands are appreciated.

A:

You can change name of db fields to make them unequivocal, for instance product.name -> product.productName, region.name -> region.regionName etc.

