Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Results</title>
- </head>
- <body>
- <style>
- body {background-image: url("margarita cookies.jpg")}
- 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, ma$
- print "$master<br />";
- if (isset($_GET['type'])&&($_GET['type'])!== 'No preference' || isset($_GET['happy_hour']) && ($_GET['happy_hour']) !=='No $
- $master.=" AND";
- }
- if (isset($_GET['type']) && ($_GET['type']!== 'No preference')){
- $master.=" type.type_id=$type";
- if (isset($_GET['happy_hour'])&&($_GET['happy_hour'])!=='No preference' || isset($_GET['flavor'])&&($_GET['flavor'])!=='$
- $master.=" AND";
- }
- }
- if (isset($_GET['happy_hour']) && ($_GET['happy_hour'] !=='No preference')){
- $master.=" happy_hour.hh_id=$hh";
- if (isset($_GET['flavor'])&&($_GET['flavor'])!== 'No preference' ||(isset($_GET['area'])&&($_GET['area'])!== 'No preferen$
- $master.=" AND";
- }
- }
- if (isset($_GET['flavor']) && ($_GET['flavor'] !=='No preference')){
- $master.=" flavor.flavor_id=$flavor";
- if (isset($_GET['area'])&&($_GET['area'])!== 'No preference' ||(isset($_GET['rest'])&&($_GET['rest'])!== 'No preference'){
- $master.=" AND";
- }
- }
- if (isset($_GET['area']) && ($_GET['area'] !=='No preference')){
- $master.=" area.area_id=$area";
- if (isset($_GET['rest'])&&($_GET['rest'])!== 'No preference'){
- $master.=" AND";
- }
- }
- if (isset($_GET['rest']) && ($_GET['rest'] !=='No preference')){
- $master.=" rest.rest_id=$rest";
- }
- $result = $link->query($master);
- print "This is the master $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$
- // 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>$
- }
- echo "</table>";
- } else {
- echo "0 results. Stop being picky, all alcohol is good alcohol!";
- }
- $conn->close();
- mysqli_close($link);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement