Blame view

api/client/liste.php 540 Bytes
acc8777f   Geoffrey PREUD'HOMME   api/utilisateur/l...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  <?php
  
  require_once("../commun.php");
  
  verifierDroit(2);
  
  $requete = $db->prepare("SELECT idCarte, solde, decouvert FROM Clients");
  if (!$requete->execute()) {
      retour("erreur_bdd", ["message" => $requete->error]);
  }
  $requete->bind_result($idCarte, $solde, $decouvert);
  $clients = [];
  while ($requete->fetch()) {
      $client = ["idCarte" => $idCarte, "solde" => $solde];
      if ($droit >= 3) {
          $client["decouvert"] = !!$decouvert;
      }
      $clients[] = $client;
  }
  $requete->close();
  
  
  retour("ok", ["clients" => $clients]);
  
  ?>