Welcome Guest, Not a member yet? Register   Sign In
Showing data in a loop, view, controller, model
#7

[eluser]SitesByJoe[/eluser]
Try this code:

Code:
$brands = $this->db->get('brands');
$models = $this->db->get('models');

foreach ($brands->result() as $brand)
{
  echo '<b>' . $brand->name . '</b><br>';
  foreach ($models->result() as $model)
  {
    if ($brand->id == $model->brand_id)
    {
      echo $model->name . '<br>';
    }
  }
}


Messages In This Thread
Showing data in a loop, view, controller, model - by El Forum - 07-24-2011, 01:14 PM
Showing data in a loop, view, controller, model - by El Forum - 07-24-2011, 08:47 PM
Showing data in a loop, view, controller, model - by El Forum - 07-24-2011, 08:47 PM
Showing data in a loop, view, controller, model - by El Forum - 07-24-2011, 09:46 PM
Showing data in a loop, view, controller, model - by El Forum - 07-24-2011, 10:52 PM
Showing data in a loop, view, controller, model - by El Forum - 07-25-2011, 05:01 AM
Showing data in a loop, view, controller, model - by El Forum - 07-25-2011, 07:15 AM
Showing data in a loop, view, controller, model - by El Forum - 07-26-2011, 09:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB