Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!<!DOCTYPE html>
- <?php
- require "menu.php";
- require "connectToDB.php";
- $ID = "";
- $error = "";
- if(isset($_GET['ssn']))
- {
- $ID = $_GET['ssn'];
- if(is_numeric($ID))
- {
- $query = "DELETE FROM `employee` WHERE `SSN_emp` = $ID";
- if (!mysqli_query($mysql_connection, $query)) {
- $er = mysqli_error($mysql_connection);
- $error = "<div class='alert alert-danger alert-dismissable fade in'>
- <strong>$er<strong>.
- </div>";
- }
- else
- {
- mysqli_close($mysql_connection);
- header("Location:employees.php");
- }
- }else
- {
- $error = "<div class='alert alert-danger alert-dismissable fade in'>
- <strong>Δεν υπάρχει υπάλληλος με αυτό το ΑΜΚΑ<strong>.
- </div>";
- }
- }
- ?>
- <html>
- <body>
- <div class="container">
- <?php echo $error;?>
- <a href="employeeAdd.php" class="btn btn-primary">Add Employee</a>
- <div class="table-responsive">
- <table class="table table-striped">
- <thead>
- <tr>
- <th>SSN Number</th>
- <th>IRS Number</th>
- <th>Identity Number</th>
- <th>Last Name</th>
- <th>First Name</th>
- <th>Driver's License</th>
- <th>City</th>
- <th>Street</th>
- <th>Street Number</th>
- <th>Postal Code</th>
- </tr>
- </thead>
- <?php
- require 'connectToDB.php';
- $query = "SELECT * FROM employee";
- if($query_run = mysqli_query($mysql_connection,$query))
- {
- while($row = mysqli_fetch_assoc($query_run))
- {
- $ssn = $row["SSN_emp"];
- $irs = $row["IRS_emp"];
- $id = $row["IdentityNumber"];
- $lname = $row["LastName"];
- $fname = $row["FirstName"];
- $driverl = $row["DriverLicense"];
- $city = $row["City"];
- $street = $row["Street"];
- $streetn = $row["StreetNumber"];
- $postal = $row["PostalCode"];
- echo '<tr><td>'.$ssn.'</td><td>'.$irs.'</td><td>'.$id.'</td><td>'.$lname.'</td><td>'.$fname.'</td><td>'.$driverl.'</td><td>'.$city.'</td><td>'.$street.'</td><td>'.$streetn.'</td><td>'.$postal.'</td>';
- echo '<td><div class="btn-group"><a class="btn btn-default" href="employees.php?id='.$ssn.'">Delete</a></div></td></tr>';
- }
- }
- else
- {
- echo 'Error';
- }
- mysqli_close($mysql_connection);
- ?>
- </table>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement