Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "vertrigo";
- $dbname = "db";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- function an($hora){
- global $conn;
- $dia = date("d");
- $mes = date("m");
- $ano = date("Y");
- $sql = "SELECT * from argenda where hora='$hora' && dia='$dia' && mes='$mes' && ano='$ano' "; // id,hora,dia,mes,ano
- $result = $conn->query($sql);
- if($result->num_rows == 0){
- return "Disponivel";
- } else{
- return "Locado";
- }
- }
- ?>
- <table align="center" class="table" id="panel-hoje-tarde" name="panel-hoje-tarde">
- <thead>
- <tr>
- <th>Horário</th>
- <th>Status</th>
- <th>Marcar</th>
- </tr>
- </thead>
- <tbody>
- <tr class="danger">
- <td>13:30</td>
- <td><?php echo an("13:30");?></td>
- <td><button type="button" name="1330" id="1330" class="btn btn-danger" disabled="disabled">Marcar horário</button></td>
- </tr>
- <tr class="success">
- <td>14:00</td>
- <td><?php echo an("14:00");?></td>
- <td><button type="button" name="1400" id="1400" class="btn btn-success">Marcar horário</button></td>
- </tr>
- <tr class="success">
- <td>14:30</td>
- <td><?php echo an("14:30");?></td>
- <td><button type="button" name="1430" id="1430" class="btn btn-success">Marcar horário</button></td>
- </tr>
- <tr class="success">
- <td>15:00</td>
- <td><?php echo an("15:00");?></td>
- <td><button type="button" name="1500" id="1500" class="btn btn-success">Marcar horário</button></td>
- </tr>
- <tr class="danger">
- <td>15:30</td>
- <td><?php echo an("15:30");?></td>
- <td><button type="button" name="1530" id="1530" class="btn btn-danger" disabled="disabled">Marcar horário</button></td>
- </tr>
- <tr class="success">
- <td>16:00</td>
- <td><?php echo an("16:00");?></td>
- <td> <button type="button" name="1600" id="1600" class="btn btn-success">Marcar horário</button></td>
- </tr>
- <tr class="danger">
- <td>16:30</td>
- <td><?php echo an("16:30");?></td>
- <td> <button type="button" name="1630" id="1630" class="btn btn-danger" disabled="disabled">Marcar horário</button></td>
- </tr>
- <tr class="danger">
- <td>17:00</td>
- <td><?php echo an("17:00");?></td>
- <td> <button type="button" name="1700" id="1700" class="btn btn-danger" disabled="disabled">Marcar horário</button></td>
- </tr>
- <tr class="success">
- <td>17:30</td>
- <td><?php echo an("17:30");?></td>
- <td> <button type="button" name="1730" id="1730" class="btn btn-success">Marcar horário</button></td>
- </tr>
- <tr class="danger">
- <td>18:00</td>
- <td><?php echo an("18:00");?></td>
- <td> <button type="button" name="1800" id="1800" class="btn btn-danger" disabled="disabled">Marcar horário</button></td>
- </tr>
- </tbody>
- </table>
Add Comment
Please, Sign In to add comment