Advertisement
Guest User

Untitled

a guest
Jul 10th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <?php
  2.  
  3. // $DB_SERVER = "localhost";
  4. // $DB_USERNAME = "root";
  5. // $DB_PASSWORD = "";
  6. // $DB_DATABASE = "eve";
  7.  
  8. // $dbh = new mysqli($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
  9.  
  10. // if ($dbh->connect_error)
  11. // {
  12. // die("Connectie Fout: " . $dbh_connect_error);
  13. // }
  14.  
  15.  
  16. $hostname='127.0.0.1';
  17. $dbname='eve';
  18. $username='clifton';
  19. $password='password';
  20.  
  21. try{
  22.  
  23. $dbh = new PDO("mysql:host=$hostname;Database=$dbname", $username, $password);
  24.  
  25. }catch(PDOException $e ){
  26.  
  27. echo "Error: ".$e;
  28.  
  29. }
  30. ?>
  31.  
  32.  
  33.  
  34. <?php
  35. include("config.php");
  36.  
  37. $end = date('Y-m-d 23:59:59',strtotime('this sunday'));
  38. switch (date('N', strtotime('today'))) {
  39. case '5':
  40. case '6':
  41. case '7':
  42. $start = date('Y-m-d H:i:s:', strtotime('now'));
  43. break;
  44.  
  45. default:
  46. $start = date('Y-m-d 00:00:00', strtotime('this friday'));
  47. break;
  48. }
  49.  
  50. $sql = $dbh->prepare("SELECT * FROM event WHERE `time` BETWEEN `time` = :starttime AND `time` = :endtime");
  51. $sql->bindValue(':starttime', $start);
  52. $sql->bindValue(':endtime', $end);
  53. $sql->execute();
  54.  
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement