Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Marg Tests</title>
- </head>
- <style>
- table, th, td {
- border: 1px solid black;
- }
- </style>
- <body>
- <h1>TESTS</h1>
- <?php
- $host="localhost";
- $username="alcohaul";
- $password="drunk";
- $database="alcohaul";
- $link= mysqli_connect($host,$username,$password,$database);
- $type = $_GET['type'];
- $hh = $_GET['happy_hour'];
- $flavor = $_GET['flavor'];
- $area = $_GET['area'];
- $rest = $_GET['rest'];
- print "<p> type = $type, happy hour = $hh, flavor = $flavor, area = $area, Restaurant Name = $rest</p>";
- $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";
- $result = $link->query($master);
- if ($result->num_rows > 0) {
- 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>";
- // output data of each row
- while($row = $result->fetch_assoc()) {
- 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>";
- }
- echo "</table>";
- } else {
- echo "0 results";
- }
- $conn->close();
- mysqli_close($link);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement