Welcome Guest, Not a member yet? Register   Sign In
Pagination and Best way for Optimization of data load
#7

[eluser][email protected][/eluser]
[quote author="Amok93" date="1371050837"][quote author="[email protected]" date="1371041415"]Hello, CI Pros:

[...]

how can I load only, for example, 100 pages at a time?

[...]

[/quote]

An example would be :

Code:
// get the number of the actual page, if segment 4 isn't set, set to 1
$page = ($this->uri->segment(4)) ? $this->uri->segment(4) : 1;

// get total amount of rows in your table
$total_rows = $this->db->get('YOUR_TABLE')->num_rows();

// items per page
$per_page = 100;

// calculate the starting row
$start_row = $page * $per_page - $per_page;

$query = $this->db->select('WHAT_YOU_WANT')
                  ->from('YOUR_TABLE')
                  ->limit($per_page, $start_row)
                  ->get();

// handle results
[/quote]

Thanks! Seems a very useful example!
Do you think I can combine the usage of pagination class for the CI with JQuery and ajax to achieve the no-refresh needed pagination? Would you plz show me some hint and, if possible and not bother so much, some code will be wonderful!

Thank you


Messages In This Thread
Pagination and Best way for Optimization of data load - by El Forum - 06-12-2013, 05:50 AM
Pagination and Best way for Optimization of data load - by El Forum - 06-12-2013, 06:38 AM
Pagination and Best way for Optimization of data load - by El Forum - 06-12-2013, 07:29 AM
Pagination and Best way for Optimization of data load - by El Forum - 06-12-2013, 08:11 AM
Pagination and Best way for Optimization of data load - by El Forum - 06-12-2013, 08:27 AM
Pagination and Best way for Optimization of data load - by El Forum - 06-12-2013, 10:57 AM
Pagination and Best way for Optimization of data load - by El Forum - 06-12-2013, 10:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB