Current Ongoing Events
connect_error) {
die("Connection Failed: " . $conn1->connect_error);
}
$currently_ongoing_query = "SELECT * FROM events AS events INNER JOIN units AS units ON events.unit_id=units.unit_id INNER JOIN alerts as alerts ON events.alert_id=alerts.alert_id where is_ongoing=1;";
$currently_ongoing_result = $conn1->query($currently_ongoing_query);
if ($currently_ongoing_result->num_rows >0){
echo "
Event ID | Unit | Alert | Start Date and Time | Description | End Date and Time | User | Updates | Attachments | Edit |
";
while ($currently_ongoing_row = $currently_ongoing_result->fetch_assoc()) {
echo "";
echo "".$currently_ongoing_row["event_id"]."";
echo " | ";
print_r($currently_ongoing_row["unit_name"]);
echo " | ";
print_r($currently_ongoing_row["alert_name"]);
echo " | ";
print_r($currently_ongoing_row["date_time_start"]);
echo " | ";
echo nl2br($currently_ongoing_row["description"]);
echo " | ";
print_r($currently_ongoing_row["date_time_end"]);
echo " | ";
print_r($currently_ongoing_row["user"]);
echo " | ";
$update_query = "SELECT update_desc, update_date_time, update_user, update_image FROM event_updates WHERE event_updates.event_id=".$currently_ongoing_row["event_id"].";";
$update_result = $conn1->query($update_query);
if ($update_result->num_rows >0){
while ($update_row = $update_result->fetch_assoc()) {
echo "";
echo "Info: ";
echo " | ";
echo nl2br($update_row['update_desc']);
echo " | ";
echo "User: ";
echo " | ";
print_r($update_row['update_user']);
echo " | ";
echo "Time: ";
echo " | ";
print_r($update_row['update_date_time']);
echo " | ";
if(empty($update_row['update_image'])) {
echo " ";
} else {
echo " |
";
echo "Image: ";
echo " | ";
echo "Attachment";
echo " |
";
}
}
} else {
echo "No updates to this event";
}
echo "
";
if(empty($currently_ongoing_row["event_image"])) {
echo "";
} else{
echo "Attachment";
}
echo " | ";
echo "Edit | ";
}
echo "";
} else {
echo "
No Ongoing Events at This Time
";
}
if ($conn1->connect_error) {
die("Connection Failed: " . $conn1->connect_error);
}
$past_event_query = "SELECT * FROM events AS events INNER JOIN units AS units ON events.unit_id=units.unit_id INNER JOIN alerts as alerts ON events.alert_id=alerts.alert_id where is_ongoing=0 ORDER BY date_time_end DESC LIMIT 10;";
$past_event_result = $conn1->query($past_event_query);
if ($past_event_result->num_rows >0){
echo "
Previous 10 Events
";
echo "This does not include ongoing events.";
echo "
Event ID | Unit | Alert | Start Date and Time | Description | End Date and Time | User | Updates | Attachments | Edit |
";
while ($past_event_row = $past_event_result->fetch_assoc()) {
echo "";
echo "".$past_event_row["event_id"]."";
echo " | ";
print_r($past_event_row["unit_name"]);
echo " | ";
print_r($past_event_row["alert_name"]);
echo " | ";
print_r($past_event_row["date_time_start"]);
echo " | ";
echo nl2br($past_event_row["description"]);
echo " | ";
print_r($past_event_row["date_time_end"]);
echo " | ";
print_r($past_event_row["user"]);
echo " | ";
$update_query = "SELECT update_desc, update_date_time, update_user, update_image FROM event_updates WHERE event_updates.event_id=".$past_event_row["event_id"].";";
$update_result = $conn1->query($update_query);
if ($update_result->num_rows >0){
while ($update_row = $update_result->fetch_assoc()) {
echo "";
echo "Info: ";
echo " | ";
echo nl2br($update_row['update_desc']);
echo " | ";
echo "User: ";
echo " | ";
print_r($update_row['update_user']);
echo " | ";
echo "Time: ";
echo " | ";
print_r($update_row['update_date_time']);
echo " | ";
if(empty($update_row['update_image'])) {
echo " ";
} else {
echo " |
";
echo "Image: ";
echo " | ";
echo "Attachment";
echo " |
";
}
}
} else {
echo "No updates to this event";
}
echo "
";
if(empty($past_event_row["event_image"])) {
echo "";
} else {
echo "Attachment";
}
echo " | ";
echo "Edit";
echo " | ";
}
echo "";
} else {
echo "
Previous 10 Events
";
echo "
No Previous Events
";
}
$conn1->close();
?>