Advertisement
Guest User

Untitled

a guest
Jun 6th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.03 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>DBMS - HW3 - 314639402 - 312237639</title>
  6.     <style>
  7.         .center{
  8.             display: block;
  9.             margin-left: auto;
  10.             margin-right: auto;
  11.             width: 30%;
  12.         }
  13.  
  14.         .textCenter{
  15.             text-align: center;
  16.         }
  17.     </style>
  18. </head>
  19. <body style="background-color: lightseagreen;text-align: center">
  20.     <h1 style="text-align: center;font-family: 'Tahoma'">Welcome to the food survey</h1>
  21.     <?php
  22.        $server = "tcp:techniondbcourse01.database.windows.net,1433";
  23.        $user = "roniza";
  24.        $pass = "Qwerty12!";
  25.        $database = "roniza";
  26.        $c = array("Database" => $database, "UID" => $user, "PWD" => $pass);
  27.         sqlsrv_configure('WarningsReturnAsErrors', 0);
  28.         $conn = sqlsrv_connect($server, $c);
  29.             if($conn === false)
  30.                 {
  31.                     echo "error";
  32.                     die(print_r(sqlsrv_errors(), true));
  33.                 }
  34.     //  echo "<center>";
  35.         echo "<table border=\"1\">";
  36.             echo "<tr><th>Sports</th><th>Average GPA</th><th>Average Weight</th></tr>";
  37.             $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";
  38.             $result=sqlsrv_query($conn,$sql);
  39.             while($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC))
  40.             {
  41.             echo "<tr><td>".$row['sport']."</td><td>".$row['Average GPA']."</td><td>".$row['Average Weight']."</td></tr>";
  42.  
  43.             }
  44.             echo "</table>"
  45.         //    echo "</center>";
  46.     ?>
  47.     <p style="text-align: center;">This is Yael Kiselman and Roni Zaitsev's site. More generic description to come.</p>
  48.     <img src="img/eating.jpg" alt="We know how to alt tag in HTML!" class="center">
  49.     <br>
  50.     <a href="upload.html">Click here for form upload page</a> | <a href="fill.html" >Click here for form fill page</a>
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement