[eluser]Sumon[/eluser]
why not you use something like:
Code:
function get_maincat_info () {
$query = $this->db->query("SELECT Cat.cat_name, SCat.subcat_name, Item.item_name FROM maincategories Cat, subcategories SCat, iteminfo Item WHERE Cat.MainCatID=$maincatid and Cat.MainCatID=SCat.MainCatID and SCat.sub_cat_id=Item.sub_cat_id");
if ($query->num_rows() > 0)
return $query->row_array();
}
writing model in this way will save your code in view as well.. use only single array
Code:
<?php foreach ($results as $row) { ?>
<?php echo $row->MainCatName;?><br>
<?php endforeach;?>
However please change my query... field name must not be same as you expect. Other will work fine