Problèmes de lenteur Datatables - Mysql
FerméAstolpho Messages postés 73 Date d'inscription vendredi 8 avril 2022 Statut Membre Dernière intervention 12 juin 2024 - 2 janv. 2024 à 12:42
- Problèmes de lenteur Datatables - Mysql
- Lenteur pc - Guide
- Mysql community server - Télécharger - Bases de données
- Mysql fatal error ✓ - Forum MySQL
- Lenteur gmail - Forum Windows
- Honor 70 lite lenteur - Forum Téléphones & tablettes Android
2 réponses
1 janv. 2024 à 21:14
Bonjour
Si tu veux de l'aide, il faut avant tout que tu montres le code qui te pose problème.
Le souci est en rarement le plugin data table mais la structure de ta base de données ou les requêtes que tu fais pour afficher ce que tu souhaites dans ta page.
2 janv. 2024 à 12:42
Bonjour Jordan,
C'est la méthode pour récupérer les informations :
class/customers.php
public function displayCustomers() { try { } catch (Exception $e) { die('Erreur : ' . $e->getMessage()); } //Connection a la bdd $db = getDB(); $stmt = $db->prepare("SELECT customers.fullname as fullname, customers.id_type_of_customers as id_type_of_customers, customers.email as email, customers.customer as customer, address as address, zipcode as zipcode, type_of_customers.type_of_customer as type_of_customer FROM customers LEFT JOIN users ON customers.id = users.id LEFT JOIN type_of_customers ON customers.id_type_of_customers = type_of_customers.id_type_of_customers WHERE customers.id = :user_id AND mode ='1'"); $stmt->bindParam(':user_id', $_SESSION['user_id']); $stmt->execute(); return $stmt->fetchAll(PDO::FETCH_ASSOC); }
L'appel de la méthode :
vue/array/displayCustomers.php
$manager = new CustomerManager();
$customerDataList = $manager->displayCustomers();
<thead>
<tr>
<th>ID</th>
<th>Fullname</th>
<th>Statut</th>
<th>Email</th>
<th>Adresse</th>
<th>Code postal</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($customerDataList as $donnees) : ?>
<tr>
<td width="1%"><a href="<?= URLSITE ?>form/customer.php?customer=<?= $donnees['customer'] ?>"><button type="button" class="btn btn-block btn-secondary btn-xs btn-flat"><i class="nav-icon fas fa-pencil"></i></td></button></a>
<td width="20%"><?= $donnees['fullname'] ?></td>
<td width="10%"><?= $donnees['type_of_customer'] ?></td>
<td width="20%"><?= $donnees['email'] ?></td>
<td width="25"><?= $donnees['address'] ?></td>
<td width="8%"><?= $donnees['zipcode'] ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
la page ou j'affiche le tableau :
array/customers.php
<?php include('../inc/head.php'); ?>
<!-- Default box -->
<?php include('../inc/title_start.php'); ?>
<h1>Clients</h1>
<?php include('../inc/title_end.php'); ?>
<?php include('../controleur/array/displayCustomers.php'); ?>
<!-- Page specific script -->
<script>
$(function() {
$("#customer").DataTable({
"responsive": true,
"lengthChange": false,
"autoWidth": true,
"buttons": ["excel", "pdf", "print"]
}).buttons().container().appendTo('#customer_wrapper .col-md-6:eq(0)');
});
</script>