load records without expanding the table!

0

Good morning! I have a table with 9000 records, what happens is that when opening the page of the table it takes to load the records with this it extends showing all the 9000 scans, so after a while it decreases showing only 10 lines of course so appearing the Next option to see other records, wanted to know how to make it load the records faster and while this loading may even appear a loading message ...!

the code is this:

index.php

<link href="../assets/css/datatables.min.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="../assets/js/jquery-1.11.3-jquery.min.js"></script>



 <table cellspacing="0" width="100%" id="example" class="table table-striped table-hover table-responsive">
    <thead>
    <tr>
    <th>Codigo</th>
    <th>Nome</th>
    <th>Sobrenome</th>
    </tr>
    </thead>
    <tbody>
    <?php
    require_once '../config/dbconfig.php';

    $stmt = $db_con->prepare("SELECT * FROM usuario ORDER BY idusuario DESC");
    $stmt->execute();
    while($row=$stmt->fetch(PDO::FETCH_ASSOC))
    {
        ?>
        <tr title="Edit" id="<?php echo $row['idusuario']; ?>" class="edit-link" onclick="#">
        <td><?php echo $row['idusuario']; ?></td>
        <td><?php echo $row['nomeusuario']; ?></td>
        <td><?php echo $row['sobreusuario']; ?></td>
        <!--<td align="center"><a id="<?php /*echo $row['emp_id'];*/ ?>" class="delete-link" href="#" title="Delete">
        <img src="delete.png" width="20px" />-->
        </a></td>
        </tr>
        <?php
    }
    ?>
    </tbody>
    </table>




<script src="../bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../assets/js/datatables.min.js"></script>
<script type="text/javascript" src="../assets/js/crudUsuario.js"></script>

<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
    $('#example').DataTable({
    "bProcessing": true,    
    });

    $('#example')
    .removeClass( 'display' )
    .addClass('table table-bordered');
});
</script>

Thanks in advance!

    
asked by anonymous 20.01.2017 / 16:23

0 answers