Welcome Guest, Not a member yet? Register   Sign In
while loop slows performance down - online
#8

[eluser]Lone[/eluser]
In my opinion there would be no performance benefits and if there was they would be minimal. If there was anything I think it would increase memory usuage as the whole $query variable is moved from the model, to the controller to the view.

Heres a quick sample to head you in the right direction:

Model
Code:
function get_studies() {
  // DB stuff here
  $result = $query->result();
  return $result;
}

Controller
Code:
function casestudies() {
  $data['casestudies'] = $this->Model_name->get_studies();
  $this->load->view('casestudies',$data);
}

View
Code:
<?php foreach($casestudies as $casestudy): ?>
        <div class="casesummary-home">
<a href="casestudies"><img src="images/&lt;?php echo mt_rand(1,6) ?&gt;/thumbs/image1.jpg">title ?&gt;" />  </a>
</div>
&lt;?php endforeach; ?&gt;


Messages In This Thread
while loop slows performance down - online - by El Forum - 07-09-2008, 03:37 AM
while loop slows performance down - online - by El Forum - 07-09-2008, 03:57 AM
while loop slows performance down - online - by El Forum - 07-09-2008, 04:12 AM
while loop slows performance down - online - by El Forum - 07-09-2008, 05:16 AM
while loop slows performance down - online - by El Forum - 07-09-2008, 05:43 AM
while loop slows performance down - online - by El Forum - 07-09-2008, 07:13 AM
while loop slows performance down - online - by El Forum - 07-09-2008, 07:26 AM
while loop slows performance down - online - by El Forum - 07-09-2008, 07:30 AM
while loop slows performance down - online - by El Forum - 07-09-2008, 07:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB