Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Employee Table</title>
- <style type="text/css">
- th {
- font-family: Arial, Helvetica, sans-serif;
- font-size: .7em;
- background: #B73B3B;
- color: #FFF;
- padding: 2px 6px;
- border-collapse: separate;
- border: 2px solid red;
- border-radius: 5px;
- }
- td {
- font-family: Arial, Helvetica, sans-serif;
- font-size: .7em;
- border: 2px solid red;
- border-radius: 5px;
- }
- </style>
- <script type="text/javascript">
- function uielement (){
- onclick ()
- }
- </script>>
- </head>
- <body>
- </body>
- </html>
- <?php
- $servername = "localhost";
- $username = "db4115944";
- $password = "db4115944";
- $dbname = "db4115944";
- //parsers for the first and last name from index.php form using the escape strings
- // we could also use htmlspecialchar for sanitation
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $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);";
- $a = $conn->query($sql);
- 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>";
- if ($a->num_rows>0){
- while($row = $a->fetch_assoc()) {
- echo "<tr>"."<td>".
- $row["fname"]."</td>"."<td>".$row["lname"]."</td>".
- "<td>".$row["ssn"]."</td>".
- "<td>".$row["bdate"]."</td>".
- "<td>".$row["dname"]."</td>".
- "<td>".$row["salary"]."</td>".
- "<td>".$row["supervisorname"]."</td>".
- "<td>"."<button class='ssn'>"."Show"."</button>"."</td>".
- "</tr>"
- ;
- }
- } else {
- echo "<br>"."0 results from db";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement