Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. 1 <?php
  2. 2 include 'include/db_check.php';
  3. 3
  4. 4 if ($result = $mysqli->query("SELECT *
  5. 5 FROM jarig
  6. 6 WHERE datum >= CURDATE() and datum <= DATE_ADD(CURDATE(), INTERVAL + 7 DAY)
  7. 7 ORDER BY datum ASC"))
  8. 8 {
  9. 9 // display records if there are records to display
  10. 10 if ($result->num_rows > 0)
  11. 11 {
  12. 12 while ($row = $result->fetch_object()){
  13. 13 $date = new DateTime($row->datum);
  14. 14
  15. 15 echo "'" . $date->format('d') . "&nbsp;" . $row->maand . "&nbsp". $row->naam . "&nbsp;";
  16. 16 echo "<br />";
  17. 17 }
  18. 18
  19. 19 }
  20. 20 // if there are no records in the database, display an alert message
  21. 21 else
  22. 22 {
  23. 23 echo "Nog niemand jarig...";
  24. 24 }
  25. 25 }
  26. 26 // show an error if there is an issue with the database query
  27. 27 else
  28. 28 {
  29. 29 echo "Error: " . $mysqli->error;
  30. 30 }
  31. 31
  32. 32 // close database connection
  33. 33 $mysqli->close();
  34. 34
  35. 35 ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement