Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Codeigniter wont display two million records [Is this a BUG?]
#1

[eluser]rochellecanale[/eluser]
Hello guys I have a problem. I have a huge amount of member. To be exact 2 million and 500 thousands rows. And when i attempt to view all this (using a pagination) it displays a white page and if a reload/refresh the browser it says:
Code:
Unable to select the specified database: emlmproj

Filename: C:\xampp\htdocs\eMLM\system\database\DB_driver.php

Line Number: 140

I double check the database.php and it is correct. And if i try to view the other listings like products and sales. It shows without an error. How can i view all my member list? Is this a bug in the framework? Please help me guys. Im running out of time. I accept any suggestions.
#2

[eluser]Aken[/eluser]
If you're using pagination, you should only be pulling a very tiny fraction of that. Chances are you're trying to select far too many records, causing the script and/or your MySQL DB to time out, hence the connection error upon reload.

A blank white page usually means an error, try adding error_reporting(E_ALL) to your controller to see if a more specific error pops up.

And post the code for your query and pagination, because I bet it's not adding a limit/offset properly.

And you don't need multiple threads about the same problem...
#3

[eluser]rochellecanale[/eluser]
Ok here's my view:
Code:
<h1 class="block">MEMBER LIST</h1>
            <div class="column1-unit">
                <br />
                <div  verdana; font-size: 12px;">
                    &lt;?php
                        echo $this->pagination->create_links();
                    ?&gt;
                </div>
                <br />
          
                 <table  100%; font-size: 8px; font-weight: normal" border="0" cellspacing="2" cellpadding="5">
            <tr>
                <td colspan="11"  #8DAF85; font-size: 20px; text-align: center; color: whitesmoke; width: 100%">MEMBERSHIP LIST</td>
            </tr>
            <tr>
                <td class='info' width="10px"  10px; text-align: center; background-color: #C7FABE">MEMBER ID</td>
                <td class='info'  10px; text-align: center; background-color: #C7FABE">USERNAME</td>
                <td class='info'  10px; text-align: center; background-color: #C7FABE">ACCOUNT TYPE</td>
                <td class='info'  10px; text-align: center; background-color: #C7FABE">EMAIL ADDRESS</td>
                <td class='info'  10px; text-align: center; background-color: #C7FABE">LASTNAME</td>
                <td class='info'  10px; text-align: center; background-color: #C7FABE">FIRSTNAME</td>
                <td class='info'  10px; text-align: center; background-color: #C7FABE">MIDDLENAME</td>
                <td class='info'  10px; text-align: center; background-color: #C7FABE">GENDER</td>
                <td class='info'  10px; text-align: center; background-color: #C7FABE">MOBILE NUMBER</td>
                <td class='info'  10px; text-align: center; background-color: #C7FABE">UPLINE</td>
            </tr>
            &lt;?php
                foreach($user->result() as $row){
                    echo "<tr>";
                        echo "<td  10px; text-align: center; background-color: #DEFEDA'>{$row->member_id}</td>";
                        echo "<td  10px; background-color: #DEFEDA'>&nbsp;&nbsp;{$row->username}&nbsp;&nbsp;</td>";
                        echo "<td  10px; text-align: center; background-color: #DEFEDA'>&nbsp;&nbsp;{$row->account_type}&nbsp;&nbsp;</td>";
                        echo "<td  10px; background-color: #DEFEDA'>&nbsp;&nbsp;{$row->email}&nbsp;&nbsp;</td>";
                        echo "<td  10px; background-color: #DEFEDA'>&nbsp;&nbsp;{$row->lastname}&nbsp;&nbsp;</td>";
                        echo "<td  10px; background-color: #DEFEDA'>&nbsp;&nbsp;{$row->firstname}&nbsp;&nbsp;</td>";
                        echo "<td  10px; background-color: #DEFEDA'>&nbsp;&nbsp;{$row->middlename}&nbsp;&nbsp;</td>";
                        echo "<td  10px; text-align: center; background-color: #DEFEDA'>&nbsp;&nbsp;{$row->gender}&nbsp;&nbsp;</td>";
                        echo "<td  10px; background-color: #DEFEDA'>&nbsp;&nbsp;{$row->mobile_number}&nbsp;&nbsp;</td>";
                        echo "<td  10px; text-align: center; background-color: #DEFEDA'>{$row->upline}</td>";
                    echo "</tr>";
                }
            ?&gt;
            </table>

My Controller:
Code:
public function getAllMember(){
            
            $config['base_url'] = "http://localhost/eMLM/index.php/admin/getAllMember";
            $config['per_page'] = 15;
            $config['num_links'] = 5;
            $config['total_rows'] = $this->db->get('member')->num_rows();
            
            $this->pagination->initialize($config);
            
            $data['user'] = $this->db->get('member', $config['per_page'], $this->uri->segment(3));
            
            $this->load->view('sites/paginatemember',$data);
            $this->load->view('templates/footer');
            
        }
#4

[eluser]Aken[/eluser]
You're retrieving all records when defining $config['total_rows']. Use this instead:

Code:
$config['total_rows'] = $this->db->count_all('member');
#5

[eluser]rochellecanale[/eluser]
That's the answer I need. Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB