Datatable taking too long to display

Datatable taking too long to display

zweenzween Posts: 1Questions: 0Answers: 0
edited August 2014 in Free community support

I am trying to display my datatable but it's taking too long around 10-15 seconds (for almost 1900 rows). When I test my request in PHPMyAdmin it takes 0.0122 secs. I don't understand why it's taking so much time to display the datatable.

If someone could help me it will be nice (sorry for my bad english). Here is my code:

.
.
.
<?php
include 'database.php';
$pdo = Database::connect();
$sql = 'SELECT * FROM sav2013_et_2014 ';
$result = $pdo->query($sql);
foreach ($result as $row) {
echo '<tr>';
echo '<td>'. $row['Num_sav'] . '</td>';
echo '<td>'. $row['Num_commande'] . '</td>';
echo '<td>'. $row['Nom_produit'] . '</td>';
echo '<td>'. $row['Nom'] . '</td>';
echo '<td>'. $row['Prenom'] . '</td>';
echo '<td>'. $row['Statut'] . '</td>';
echo '<td>';
echo '<a class="btn btn-info btn-large active" href="update.php?id='.$row['id'].'">Editer</a>';
echo ' ';
echo '</td>';
echo '</tr>';
}
Database::disconnect();

<?php > ?>

Ps : I tried to remove the Datatable options, the data appear after 0.1 sec and I can't finish my project if I don't have those options.
(My javascript code is at the bottom to have a "fast" loading).

Here my javascript code :

$(document).ready(function() { $('#datatables').dataTable( { "oLanguage": { "sUrl": "fr_FR.json" }, "scrollY": "400px", "scrollX": true, "scrollCollapse": true, "paging": true } ); } );
This discussion has been closed.