[eluser]Nick Husher[/eluser]
You could do a left join with an orderby on your package ID. I think it would go like this in your active record class:
Code:
$this->db->select('cms_packages.package_info, cms_features.feature_info');
$this->db->from('cms_packages, cms_features, cms_package_features');
$this->db->where('cms_packages.package_id','cms_package_features.package_id');
$this->db->where('cms_features.feature_id','cms_package_features.feature_id');
if( /* you want to display by feature */) {
$this->db->orderby('cms_features.feature_id');
} else {
$this->db->orderby('cms_packages.package_id');
}
$result = $this->db->get();
This returns a lot of repetition that'll look like this:
Code:
'cms1 -> cms_feature1'
'cms1 -> cms_feature2'
'cms1 -> cms_feature3'
'cms2 -> cms_feature1'
'cms2 -> cms_feature3'
etc...
Or the opposite effect if you order it by features.
Note that I didn't test it, but it should be the Active Record equivalent to the SQL I tested this with, which looks like this:
Code:
mysql> select cms.cms_name, feature.feature_text from cms, feature, cms_features where cms_features.cms_id = cms.id and cms_features.feature_id = feature.id order by cms.cms_name;
Also: It won't display cms entries that have no features.