Advertisement
tmen

coachReviewExcuse.php

Jan 7th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Untitled Document</title>
  6. </head>
  7.  
  8. <body>
  9. <?php
  10. $servername = "localhost";
  11. $username = "playground18";
  12. $password = "Cdz5SOVrY2p8fnWS";
  13. $dbname = "playground18";
  14. $id = $_GET['ID'];
  15. $curtime = date("Y-m-d");
  16.  
  17. try
  18. {
  19. $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
  20. $sql = "UPDATE tanay_xcatt_absences SET review_status = 'excused' WHERE id='$id'";
  21. $conn->exec($sql);
  22. $sql = "SELECT person FROM `tanay_xcatt_absences` WHERE id = '$id'";
  23. $result = $conn->prepare($sql);
  24. $result->execute();
  25. $per = $result->fetchColumn();
  26. $sql = "SELECT excused_absences FROM tanay_xcatt_runners WHERE name='$per'";
  27. $result = $conn->prepare($sql);
  28. $result->execute();
  29. $EA = $result->fetchColumn();
  30. $EA=$EA+1;
  31. $sql = "UPDATE tanay_xcatt_runners SET excused_absences = $EA WHERE name='$per'";
  32. $conn->exec($sql);
  33. $sql = "UPDATE tanay_xcatt_absences SET review_date = '$curtime' WHERE id='$id'";
  34. $conn->exec($sql);
  35. }
  36. catch(PDOException $e)
  37. {
  38. echo "Error: " . $e->getMessage();
  39. }
  40. $conn = null;
  41. header('Location: coachUnreviewedAbsences.php');
  42. ?>
  43. </body>
  44. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement