Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Marg Tests</title>
  4. </head>
  5. <style>
  6. table, th, td {
  7. border: 1px solid black;
  8. }
  9. </style>
  10. <body>
  11. <h1>TESTS</h1>
  12. <?php
  13. $host="localhost";
  14. $username="alcohaul";
  15. $password="drunk";
  16. $database="alcohaul";
  17. $link= mysqli_connect($host,$username,$password,$database);
  18. $type = $_GET['type'];
  19. $hh = $_GET['happy_hour'];
  20. $flavor = $_GET['flavor'];
  21. $area = $_GET['area'];
  22. $rest = $_GET['rest'];
  23. print "<p> type = $type, happy hour = $hh, flavor = $flavor, area = $area, Restaurant Name = $rest</p>";
  24. $master = "SELECT master.master_id, rest.rest, marg.marg, area.area, flavor.flavor, type.type, happy_hour.hh FROM master, marg, rest, area, flavor, type, happy_hour WHERE master.marg_id = marg.marg_id AND master.rest_id = rest.rest_id AND master.area_id = area.area_id AND master.flavor_id = flavor.flavor_id AND master.type_id = type.type_id AND master.hh_id = happy_hour.hh_id AND flavor.flavor_id = $flavor ORDER BY rest.rest, marg.marg";
  25. $result = $link->query($master);
  26. if ($result->num_rows > 0) {
  27. echo "<table><tr><th>Restaurant</th><th>Margarita Name</th><th>Area of Austin</th><th>Margarita Flavor</th><th>Frozen or On the Rocks?</th><th>Happy Hour?</th></tr>";
  28. // output data of each row
  29. while($row = $result->fetch_assoc()) {
  30. echo "<tr><td>".$row["rest"]."</td><td>".$row["marg"]."</td><td>".$row["area"]."</td><td>".$row["flavor"]."</td><td>".$row["type"]."</td><td>".$row["hh"]."</td></tr>";
  31. }
  32. echo "</table>";
  33. } else {
  34. echo "0 results";
  35. }
  36. $conn->close();
  37.  
  38. mysqli_close($link);
  39. ?>
  40.  
  41. </body>
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement