Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>DBMS - HW3 - 314639402 - 312237639</title>
- <style>
- .center{
- display: block;
- margin-left: auto;
- margin-right: auto;
- width: 30%;
- }
- .textCenter{
- text-align: center;
- }
- </style>
- </head>
- <body style="background-color: lightseagreen;text-align: center">
- <h1 style="text-align: center;font-family: 'Tahoma'">Welcome to the food survey</h1>
- <?php
- $server = "tcp:techniondbcourse01.database.windows.net,1433";
- $user = "roniza";
- $pass = "Qwerty12!";
- $database = "roniza";
- $c = array("Database" => $database, "UID" => $user, "PWD" => $pass);
- sqlsrv_configure('WarningsReturnAsErrors', 0);
- $conn = sqlsrv_connect($server, $c);
- if($conn === false)
- {
- echo "error";
- die(print_r(sqlsrv_errors(), true));
- }
- // echo "<center>";
- echo "<table border=\"1\">";
- echo "<tr><th>Sports</th><th>Average GPA</th><th>Average Weight</th></tr>";
- $sql = "SELECT sport , AVG (F.GPA) as Average GPA, AVG (F.weight) as Average Weight FROM Food WHERE F.coffee = 2 and F.comfort_food = 'chocolate' GROUP BY sport";
- $result=sqlsrv_query($conn,$sql);
- while($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC))
- {
- echo "<tr><td>".$row['sport']."</td><td>".$row['Average GPA']."</td><td>".$row['Average Weight']."</td></tr>";
- }
- echo "</table>"
- // echo "</center>";
- ?>
- <p style="text-align: center;">This is Yael Kiselman and Roni Zaitsev's site. More generic description to come.</p>
- <img src="img/eating.jpg" alt="We know how to alt tag in HTML!" class="center">
- <br>
- <a href="upload.html">Click here for form upload page</a> | <a href="fill.html" >Click here for form fill page</a>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement