Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Gestion de la caisse des appartements</title>
- </head>
- <body>
- <h1>Gestion de la caisse des appartements</h1>
- <!-- Tableau d'affichage des entrées/sorties -->
- <h2>Tableau d'affichage des entrées/sorties</h2>
- <table border="1">
- <tr>
- <th>Date</th>
- <th>Numéro d'appartement</th>
- <th>Nom du locataire</th>
- <th>Service</th>
- <th>Montant</th>
- <th>Moyen de paiement</th>
- <th>Type (Entrée/Sortie)</th>
- </tr>
- <?php
- // Define database credentials
- $servername = "localhost";
- $username = "your_username";
- $password = "your_password";
- $dbname = "your_database_name";
- // Create a connection to the database
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check if the connection is successful
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- // Retrieve all the entries from the table 'caisse'
- $sql_select = "SELECT * FROM caisse";
- $result_select = $conn->query($sql_select);
- if ($result_select->num_rows > 0) {
- // Output each row of the table 'caisse'
- while($row = $result_select->fetch_assoc()) {
- echo "<tr><td>" . $row["date"] . "</td><td>" . $row["numero_appart"] . "</td><td>" . $row["nom_locataire"] . "</td><td>" . $row["service"] . "</td><td>" . $row["montant"] . "</td><td>" . $row["moyen_paiement"] . "</td><td>" . $row["type"] . "</td></tr>";
- }
- } else {
- echo "<tr><td colspan='7'>Il n'y a aucune entrée/sortie dans la caisse pour le moment.</td></tr>";
- }
- // Close the database connection
- $conn->close();
- ?>
- </table>
- <!-- Formulaire d'ajout d'entrée/sortie -->
- <h2>Ajouter une entrée/sortie</h2>
- <form method="post">
- <label for="type">Type :</label>
- <select name="type" id="type">
- <option value="Entree">Entrée</option>
- <option value="Sortie">Sortie</option>
- </select><br><br>
- <label for="numero_appart">Numéro d'appartement :</label>
- <select name="numero_appart" id="numero_appart">
- <?php
- // Create a connection to the database
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check if the connection is successful
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- // Retrieve all the entries from the table 'appartements'
- $sql_select = "SELECT * FROM appartements";
- $result_select = $conn->query($sql_select);
- if ($result) {
- $row = mysqli_fetch_assoc($result);
- $nom = $row['nom'];
- $prenom = $row['prenom'];
- echo "Nom : $nom<br>";
- echo "Prénom : $prenom<br>";
- } else {
- echo "Aucun locataire trouvé pour cet appartement.";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement