Fetch records from database given limit Ajax data table

Fetch records from database given limit Ajax data table

bala16bala16 Posts: 5Questions: 4Answers: 0
edited September 2016 in Free community support

In my database a table contains millions of records. i want to view it like datatables. but using data tables page take too long time to load my db is crashed. I want only one I need fetch records given limit(Like us 10, 20 etc), if i click next button, at that time only next 10 records fetched from database, and also search box is needed like us data tables.. What can i do for this problem.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,680Questions: 1Answers: 10,498 Site admin

    Sounds like you want to use server-side processing. See this manual page for an overview of client-side and server-side processing.

    Allan

  • bala16bala16 Posts: 5Questions: 4Answers: 0
    edited September 2016

    @allan Thanks, Did You send Any Sample Files Or Codes For server Side Processing, Am A beginner, Please Help Us.. And Also I need pagination, sorting, search.

  • allanallan Posts: 63,680Questions: 1Answers: 10,498 Site admin
    Answer ✓

    No I didn't send any sample files. There is an example here which uses PHP.

    Allan

  • developer999developer999 Posts: 6Questions: 2Answers: 0

    Hello Allan ,
    I have seen the example and i have put the code below
    $(document).ready(function() {
    $('#example').dataTable({
    "processing": true,

                     "sAjaxSource": "<?= base_url();?>index.php/test",
                     "aoColumns": [
                            { mData: 'A_ID' },
                            { mData: 'Member_ID' },
                            { mData: 'First_Name' },
    
                    ],
                     "deferLoading": 57
    
         }); 
    

    } );

    In This Code "deferLoading": 57 is not working . when i go to 1 page to 2nd page the processing or loader is not dispaly. some time it will gives memory error. I have 5 million record in my data table. can you please help me.

  • developer999developer999 Posts: 6Questions: 2Answers: 0

    I am getting this below error in my firebug.

    <b>Fatal error</b>: Allowed memory size of 134217728 bytes exhausted (tried to allocate 5242940 bytes) in <b>D:\projects</b> on line <b>47</b><br />

    A PHP Error was encountered

    Severity: Error

    Message: Allowed memory size of 134217728 bytes exhausted (tried to allocate 5242940 bytes)

    Filename: controllers/Test.php

    Line Number: 47

    Backtrace:

    My sir will not allow memory in the php.ini file. they told me that without memory allocation get the solution . have you any solution for the same. I am waiting for your reply.

  • allanallan Posts: 63,680Questions: 1Answers: 10,498 Site admin

    The deferLoading option over works with serverSide which you are not using.

    Let's not have this same conversation in two different places. I'm going to close this thread in favour of your other one on this topic.

    Allan

This discussion has been closed.