Guest User

Untitled

a guest
Nov 23rd, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. <?php
  2. function connect() {
  3. $host = '';
  4. $user = '';
  5. $pass = '';
  6. $db = '';
  7.  
  8. $connect = mysqli_connect($host,$user,$pass,$db)
  9. or die('Failed to connect to db');
  10. return $connect;
  11. }
  12.  
  13. function showReminder($sock,$user) {
  14. ## connect and check for reminders else return No reminders.
  15. ## call delete()
  16. $string = "SELECT * FROM `table` WHERE user = `$user`";
  17. $query = mysqli_query($sock,$string)
  18. or echo "Failed to get notifications\n";
  19.  
  20. echo ("
  21. <table width=\"90%\" border=\"0\" align=\"center\">
  22. <tr>
  23. <td colspan=\"3\">List Of Reminder</ td>
  24. </ tr>
  25. ");
  26.  
  27.  
  28. while ($results = mysqli_fetch_array($query)) {
  29. $id = results["id"];
  30. $title = $results["title"];
  31. $description = $results["description"];
  32. $date = $results["date"];
  33. $prior = $result["prior"];
  34. echo ("
  35. <tr>
  36. <td width=\"40%">$title</td>
  37. <td width=\"30%\">$date</td>
  38. <td width=\"10%\">$prior</td>
  39. <td width=\"10%\"><a href=\"setReminder.php?id=$id> delete </a > </ td>
  40. </tr>
  41. ");
  42. }
  43. }
  44.  
  45. function delete($sock) {
  46. ## Check if "id" is passed to the page and delete it
  47. $id = $_GET["id"];
  48. if (!empty($id)) {
  49. $string = "DELETE FROM `table` WHERE id = mysqli_real_escape_string($sock,$id)";
  50. $query = mysqli_query($sock,$string);
  51. }
  52. }
  53. ?>
Add Comment
Please, Sign In to add comment