- Problèmes de lenteur Datatables - Mysql
- Lenteur pc - Guide
- Mysql community server - Télécharger - Bases de données
- Mysql gratuit ou payant - Forum MySQL
- Phpmyadmin a tenté de se connecter au serveur mysql, et le serveur a rejeté la connexion. merci de vérifier les valeurs de host, username et password dans la configuration et de s'assurer qu'elles correspondent aux informations fournies par l'administrateur du serveur mysql. ✓ - Forum PHP
- Could not connect to mysql! please check your database settings! - Forum Redhat
2 réponses
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.
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>