-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeteventsTotal.php
41 lines (33 loc) · 1.38 KB
/
geteventsTotal.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
include('./conn.php');
date_default_timezone_set("Asia/Manila");
$currentDate = date("Y-m-d");
$tommorow = date('Y-m-d', strtotime(' +1 day'));
$upcoming = date('Y-m-d', strtotime(' +2 day'));
// get title of today event
$eventName = mysqli_query($db, "SELECT * FROM events WHERE startdate='$currentDate'");
// $record = mysqli_fetch_array($eventName);
// $eName = $record['eName'];
// today event
$sql = "SELECT count(id) AS total FROM events WHERE startdate='$currentDate'";
$rows_results = mysqli_query($db, $sql);
$values = mysqli_fetch_assoc($rows_results);
$today = $values['total'];
// tommorow event
$sql = "SELECT count(id) AS total FROM events WHERE startdate='$tommorow'";
$rows_results = mysqli_query($db, $sql);
$values = mysqli_fetch_assoc($rows_results);
$tommorowEvent = $values['total'];
// upcoming events
$sql = "SELECT count(id) AS total FROM events WHERE startdate>='$upcoming'";
$rows_results = mysqli_query($db, $sql);
$values = mysqli_fetch_assoc($rows_results);
$upcomingEvents = $values['total'];
// past events
$sql = "SELECT count(id) AS total FROM events WHERE startdate<'$currentDate'";
$rows_results = mysqli_query($db, $sql);
$values = mysqli_fetch_assoc($rows_results);
$pastEvents = $values['total'];
$more = 'events';
$justOne = 'event'
?>