Advertisement
Guest User

Untitled

a guest
Dec 30th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.34 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "vertrigo";
  5. $dbname = "db";
  6.  
  7. $conn = new mysqli($servername, $username, $password, $dbname);
  8. if ($conn->connect_error) {
  9.     die("Connection failed: " . $conn->connect_error);
  10. }
  11.  
  12. function an($hora){
  13. global $conn;
  14. $dia = date("d");
  15. $mes = date("m");
  16. $ano = date("Y");
  17. $sql = "SELECT * from argenda where hora='$hora' && dia='$dia' && mes='$mes' && ano='$ano' "; // id,hora,dia,mes,ano
  18. $result = $conn->query($sql);
  19. if($result->num_rows == 0){
  20.     return "Disponivel";
  21. } else{
  22.     return "Locado";
  23. }
  24. }
  25.  
  26.  
  27. ?>
  28. <table align="center" class="table" id="panel-hoje-tarde" name="panel-hoje-tarde">
  29.         <thead>
  30.           <tr>
  31.             <th>Horário</th>
  32.             <th>Status</th>
  33.             <th>Marcar</th>
  34.           </tr>
  35.         </thead>
  36.         <tbody>
  37.           <tr class="danger">
  38.             <td>13:30</td>
  39.             <td><?php echo an("13:30");?></td>
  40.             <td><button type="button" name="1330" id="1330" class="btn btn-danger" disabled="disabled">Marcar horário</button></td>
  41.  
  42.           </tr>
  43.           <tr class="success">
  44.             <td>14:00</td>
  45.             <td><?php echo an("14:00");?></td>
  46.             <td><button type="button" name="1400" id="1400" class="btn btn-success">Marcar horário</button></td>
  47.  
  48.           </tr>
  49.           <tr class="success">
  50.             <td>14:30</td>
  51.             <td><?php echo an("14:30");?></td>
  52.             <td><button type="button" name="1430" id="1430" class="btn btn-success">Marcar horário</button></td>
  53.  
  54.           </tr>
  55.           <tr class="success">
  56.             <td>15:00</td>
  57.             <td><?php echo an("15:00");?></td>
  58.             <td><button type="button" name="1500" id="1500" class="btn btn-success">Marcar horário</button></td>
  59.  
  60.           </tr>
  61.           <tr class="danger">
  62.             <td>15:30</td>
  63.             <td><?php echo an("15:30");?></td>
  64.             <td><button type="button" name="1530" id="1530" class="btn btn-danger" disabled="disabled">Marcar horário</button></td>
  65.  
  66.           </tr>
  67.           <tr class="success">
  68.             <td>16:00</td>
  69.             <td><?php echo an("16:00");?></td>
  70.             <td> <button type="button" name="1600" id="1600" class="btn btn-success">Marcar horário</button></td>
  71.  
  72.           </tr>
  73.           <tr class="danger">
  74.             <td>16:30</td>
  75.             <td><?php echo an("16:30");?></td>
  76.             <td> <button type="button" name="1630" id="1630" class="btn btn-danger" disabled="disabled">Marcar horário</button></td>
  77.  
  78.           </tr>
  79.           <tr class="danger">
  80.             <td>17:00</td>
  81.             <td><?php echo an("17:00");?></td>
  82.             <td> <button type="button" name="1700" id="1700" class="btn btn-danger" disabled="disabled">Marcar horário</button></td>
  83.  
  84.           </tr>
  85.           <tr class="success">
  86.             <td>17:30</td>
  87.             <td><?php echo an("17:30");?></td>
  88.             <td> <button type="button" name="1730" id="1730" class="btn btn-success">Marcar horário</button></td>
  89.  
  90.           </tr>
  91.           <tr class="danger">
  92.             <td>18:00</td>
  93.             <td><?php echo an("18:00");?></td>
  94.             <td>                <button type="button" name="1800" id="1800" class="btn btn-danger" disabled="disabled">Marcar horário</button></td>
  95.  
  96.           </tr>
  97.          
  98.         </tbody>
  99.       </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement