Welcome Guest, Not a member yet? Register   Sign In
Looping data
#1

[eluser]snowstar[/eluser]
Hi All

Im trying find a better way to do this

My Controller:

Code:
function printview($uniqueid)
{
  $members = $this->entry_model->get_members_forprintview($uniqueid);
  $data['members'] = $members;

  for($i = 0; $i < count($members); $i++){
  
   $member[$i] = $members[$i]['school'];
  
  }
  
  if (($member[0] == $member[1]) && ($member[1] == $member[2]) && ($member[2] == $member[3])) {
     echo 'They are all the same';
  }
  
  $this->load->view('print_view', $data);
}

Basically im looping through assigning a value from the database to a variable. Then im checking to see if the variable matches. This technically works how-ever its not dynamic (the band member amount will change each time)

Can any one recommend a better way of doing this? im out of ideas


Messages In This Thread
Looping data - by El Forum - 02-20-2012, 08:39 PM
Looping data - by El Forum - 02-20-2012, 09:22 PM
Looping data - by El Forum - 02-20-2012, 09:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB