Welcome Guest, Not a member yet? Register   Sign In
Help with Prefetching Next Record in DB
#3

[eluser]pickupman[/eluser]
I used something like this before (similar to links at the bottom of the page for the forums. The part I don't like about my solution is having to return the query resource and not the result object.
Code:
//In model
return $query->get();

//In Controller
$destinations = $this->times_model->get_records($limit, $offset);

$id = $this->uri->segment(3,0); //Current ID
$i  = 0;
$marker = $destinations; //Copy result set

foreach($destinations->result() as $destination){

   if($destination->id == $id){
      $next     = $marker->row($i+1);
      $previous = $marker->row($i-1);
   }
   $i++;
}


Messages In This Thread
Help with Prefetching Next Record in DB - by El Forum - 01-11-2011, 11:14 AM
Help with Prefetching Next Record in DB - by El Forum - 01-11-2011, 02:14 PM
Help with Prefetching Next Record in DB - by El Forum - 01-11-2011, 02:24 PM
Help with Prefetching Next Record in DB - by El Forum - 01-11-2011, 05:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB