Advertisement
Guest User

Untitled

a guest
Jul 15th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "booking";
  6.  
  7. //Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9.  
  10. //Check connection
  11. if ($conn->connect_error)
  12. {
  13. die('Could not connect: ' . $conn->connect_error);
  14. }
  15.  
  16. $sql = "SELECT room_id, qty_reserve, arrival, departure, FROM roominventory";
  17.  
  18. $result = $conn->query($sql);
  19.  
  20. if ($result->num_rows > 0) {
  21.  
  22. //Outout data of each row
  23. while($row = $result->fetch_assoc()) {
  24.  
  25. echo "<br> room_id: ". $row["room_id"]. $row["qty_reserve"]. $row["arrival"] . $row["departure"] . "<br>";
  26.  
  27. $angavil = $row['qty'] - $inogbuwin;
  28.  
  29. echo '<div style="height: 117px;">';
  30. echo '<div style="float: left; width: 100px; margin-left: 19px;">';
  31. echo "<img width=92 height=72 alt='Unable to View' src='" . $row["image"] . "'>";
  32. echo '</div>';
  33. echo '<div style="float: right; width: 575px; margin-top: -10px;">';
  34. echo '<span class="style5">'.'Avalable Rooms: '.$angavil.'</span>';
  35. if ($angavil > 0){
  36. echo '<input name="roomid" type="checkbox" value="' .$row["room_id"]. '" />';
  37. echo '<input type="submit" name="Submit" value="reserve" onclick="setDifference(this.form);"/>';
  38. }
  39. if ($angavil <= 0){
  40. echo '<span class="style5">'.'wala chansa wala gid vacant'.'</span>';
  41. }
  42. echo '<br>';
  43. echo '<span class="style5">'.'Room Type: '.$row['type'].'</span><br>';
  44. echo '<span class="style5">'.'Room Rate: '.$row['rate'].'</span><br>';
  45. echo '<span class="style5">'.'Max Child: '.$row['max_child'].'</span><br>';
  46. echo '<input name="mchild" type="hidden" value="' .$row["max_child"]. '" />';
  47. echo '<input name="avail" type="hidden" value="' .$angavil. '" />';
  48. echo '<span class="style5">'.'Max Adult: '.$row['max_adult'].'</span><br>';
  49. echo '<input name="madult" type="hidden" value="' .$row["max_adult"]. '" />';
  50. echo '<span class="style5">'.'Room Description: '.$row['description'].'</span><br>';
  51. echo '</div>';
  52. echo '</div>';
  53.  
  54. }
  55.  
  56. }else {
  57.  
  58. echo "No rooms currently available for booking!";
  59.  
  60. }
  61.  
  62. $conn->close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement