Advertisement
Guest User

Prof Marko's HW - Shakir

a guest
Mar 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.01 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Employee Table</title>
  5.     <style type="text/css">
  6.    
  7. th {
  8.     font-family: Arial, Helvetica, sans-serif;
  9.     font-size: .7em;
  10.     background: #B73B3B;
  11.     color: #FFF;
  12.     padding: 2px 6px;
  13.     border-collapse: separate;
  14.     border: 2px solid red;
  15.     border-radius: 5px;
  16. }
  17.  
  18. td {
  19.     font-family: Arial, Helvetica, sans-serif;
  20.     font-size: .7em;
  21.      border: 2px solid red;
  22.     border-radius: 5px;
  23. }
  24.  
  25.  
  26.     </style>
  27.     <script type="text/javascript">
  28.         function uielement (){
  29.  
  30.             onclick ()
  31.         }
  32.  
  33.     </script>>
  34. </head>
  35. <body>
  36.  
  37. </body>
  38. </html>
  39.  
  40. <?php
  41.  
  42.     $servername = "localhost";
  43.     $username = "db4115944";
  44.     $password = "db4115944";
  45.     $dbname = "db4115944";
  46.  
  47.     //parsers for the first and last name from index.php form using the escape strings
  48.     // we could also use htmlspecialchar for sanitation
  49.  
  50.      $conn = new mysqli($servername, $username, $password, $dbname);
  51.     if ($conn->connect_error) {
  52.         die("Connection failed: " . $conn->connect_error);
  53.     }
  54.  
  55.     $sql = "SELECT E.fname, E.lname, E.ssn,E.bdate, D.dname, E.address, E.sex, E.salary, CONCAT(S.fname,S.lname) as supervisorname from employee E left join employee S on (E.superssn = S.ssn), department D where (E.dno=D.dnumber);";
  56.     $a = $conn->query($sql);
  57. echo "<br><br><br>"."<table border='4' id='style' class='stats' cellspacing='0'>"."<tr>"."<th>"."First Name"."</th>"."<th>"."Surname"."</th>"."<th>"."SSN"."</th>"."<th>"."bdate"."</th>"."<th>"."dname"."</th>"."<th>"."Salary"."</th>"."<th>"."SV"."</th>"."</tr>";
  58.    if ($a->num_rows>0){
  59.   while($row = $a->fetch_assoc()) {
  60.  
  61. echo "<tr>"."<td>".
  62. $row["fname"]."</td>"."<td>".$row["lname"]."</td>".
  63. "<td>".$row["ssn"]."</td>".
  64. "<td>".$row["bdate"]."</td>".
  65. "<td>".$row["dname"]."</td>".
  66. "<td>".$row["salary"]."</td>".
  67. "<td>".$row["supervisorname"]."</td>".
  68. "<td>"."<button class='ssn'>"."Show"."</button>"."</td>".
  69. "</tr>"
  70. ;
  71.     }
  72. } else {
  73.     echo "<br>"."0 results from db";
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement