Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Allowed memory size of xxxbytes exhausted
#11

This is what the Pagination Library is used for to limit the number of records retrieved.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#12

(10-24-2015, 11:11 AM)InsiteFX Wrote: This is what the Pagination Library is used for to limit the number of records retrieved.

As per pagination library I have to give "total_rows",  For the total count  my  query is getting exhausted .


Code:
$this->load->library('pagination');

$config['base_url'] = 'http://example.com/index.php/test/page/';
$config['total_rows'] = 200; [ I am getting error here , counting 300K-500K records creating memory out problem ]
$config['per_page'] = 20;

$this->pagination->initialize($config);

echo $this->pagination->create_links();

 Any way thanks. Now I am considering changing DB structure to divide tables. Let's see.
Reply
#13

(10-26-2015, 08:07 AM)chandrabhanu Wrote:
Code:
$this->load->library('pagination');

$config['base_url'] = 'http://example.com/index.php/test/page/';
$config['total_rows'] = 200; [ I am getting error here , counting 300K-500K records creating memory out problem ]

Huh? How do count your rows? Don't you know about "select count(*)" ? How can it use so much memories if it returns a single number?
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#14

(10-30-2015, 08:12 PM)includebeer Wrote:
(10-26-2015, 08:07 AM)chandrabhanu Wrote:
Code:
$this->load->library('pagination');

$config['base_url'] = 'http://example.com/index.php/test/page/';
$config['total_rows'] = 200; [ I am getting error here , counting 300K-500K records creating memory out problem ]

Huh? How do count your rows? Don't you know about "select count(*)" ? How can it use so much memories if it returns a single number?

Hi, I am using $this->db->count _all() . From your reply tone  I think , I am doing some mistake. Let me check once again the complete code so that I can reply in details. Thanks
Reply
#15

(This post was last modified: 10-31-2015, 08:08 AM by includebeer.)

(10-30-2015, 10:50 PM)chandrabhanu Wrote:
(10-30-2015, 08:12 PM)includebeer Wrote: Huh? How do count your rows? Don't you know about "select count(*)" ? How can it use so much memories if it returns a single number?

Hi, I am using $this->db->count _all() . From your reply tone  I think , I am doing some mistake. Let me check once again the complete code so that I can reply in details. Thanks

That's weird because count_all() do a "select count(*)", it doesn't fetch all the data. So I don't understand why you would run out of memory! Confused
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply




Theme © iAndrew 2016 - Forum software by © MyBB