Advertisement
Guest User

Untitled

a guest
Jul 9th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. <?php
  2. $HOST = 'localhost';
  3. $USERNAME = 'root';
  4. $PASSWORD = '';
  5. $DB = 'orangehrm';
  6.  
  7. $link = mysqli_connect($HOST,$USERNAME,$PASSWORD,$DB);
  8.  
  9. if($_GET['action'] == 'add'){
  10. $aid = $_GET['id'];
  11. $query4 = 'SELECT * FROM hs_hr_employee_leave_quota WHERE employee_id = $aid';
  12. $result4 = mysqli_query($link,$query4) or die (mysqli_query_error($link));
  13. while($row=mysqli_fetch_assoc($result)){
  14. $days = $row['no_of_days_allotted'];
  15. }
  16. }
  17.  
  18. $query = 'SELECT * FROM hs_hr_employee';
  19. $result = mysqli_query($link,$query) or die (mysqli_query_error($link));
  20. ?>
  21.  
  22. <table border='1' cellpadding='0' cellspacing='0'>
  23. <?php
  24. echo "<tr>";
  25. echo "<td>Emp Number</td>";
  26. echo "<td>Name</td>";
  27.  
  28. echo "</tr>";
  29.  
  30. while($row=mysqli_fetch_assoc($result)){
  31. if ($row['emp_gender'] == 1 && $row['emp_marital_status'] == 'Married'){
  32. $id = $row['emp_number'];
  33. $name = $row['emp_firstname'];
  34. $count = 0;
  35.  
  36. $query2 = 'SELECT * FROM hs_hr_emp_children WHERE emp_number ="'.$id.'"';
  37. $result2 = mysqli_query($link,$query2) or die (mysqli_query_error($link));
  38. while($row2=mysqli_fetch_assoc($result2)){
  39. $count++;
  40.  
  41. }
  42.  
  43. if ($count > 0){
  44. echo "<tr>";
  45. echo "<td>".$row['emp_number']."</td>";
  46. echo "<td>".$row['emp_firstname']."</td>";
  47. echo "<td><a href='marriageleave.php?id=".$row['emp_number']."&action=add'>Add Leave</a></td>";
  48. echo "</tr>";
  49. }
  50.  
  51. }
  52. }
  53. echo "</table>";
  54.  
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement