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

[eluser]Unknown[/eluser]
Hi all, I'm new to CodeIgniter and need some help with pre-fetching the next record in database from a result.

Essentially it's a list of destinations, I need to pre-fetch the next destination in the list.

Is there an easy way to do this?

My current model contains:

Code:
class Times_model extends Model{

  function __construct(){
    parent::Model();
  }

  function get_records($limit, $offset){
    $query = $this->db->select('*')
             ->from('times')
             ->join('vehicles', 'vehicles.vehicle_id = times.vehicle_id')
             ->join('locations', 'locations.location_id = times.location_id')
             ->where('complete', 0)
             ->where('view', 1)
             ->order_by('time, type', 'asc')
             ->limit($limit, $offset);

    $data = $query->get()->result();

    return $data;
  }
}

Any and all help is appreciated.

PS


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