<?php
                        $sql = "SELECT * FROM announcements WHERE church_group='all' ORDER BY ID DESC LIMIT 1";
                        $conn->query($sql);
                        $rowCount = $conn->rowCount();
                        $result = $conn->fetchMultiple();
                        if($rowCount > 0){
                          foreach ($result as $announcement):
                              $newstitle = $announcement->title;
                              $newsnote = $announcement->note;
                              $newsposted_on = $announcement->posted_on;

                              $datetime = new DateTime("$newsposted_on");
                        
                        ?><div class="notification-body scrollable">
                      <!-- START Notification Item-->
                      <div class="notification-item unread clearfix">
                        <!-- START Notification Item-->
                        <div class="heading open">
                          <a href="#" class="text-complete pull-left d-flex align-items-center">
                            <i class="pg-icon m-r-10">mic</i>
                            <span class="bold"><?php echo $title; ?></span>
                            <!-- <span class="fs-12 m-l-10">David Nester</span> -->
                          </a>
                          <div class="pull-right">
                            <div class="thumbnail-wrapper d16 circular inline m-t-15 m-r-10 toggle-more-details">
                              <div><i class="pg-icon">chevron_down</i>
                              </div>
                            </div>
                            <span class=" time"><time class="timeago" datetime="<?php echo $datetime->format(DateTime::ATOM); ?>"><?php echo $datetime->format(DateTime::ATOM); ?></span>
                          </div>
                          <div class="more-details">
                            <div class="more-details-inner">
                              <h6 style="font-size: 12px" class="semi-bold"><?php echo $note; ?></h6>

                            </div>
                          </div>
                        </div>
                        <!-- END Notification Item-->
                        <!-- START Notification Item Right Side-->
                        <div class="option" data-toggle="tooltip" data-placement="left" title="mark as read">
                          <a href="#" class="mark"></a>
                        </div>
                        <!-- END Notification Item Right Side-->
                      </div>
                      <!-- START Notification Body-->
                      <!-- START Notification Item-->
                      <div class="notification-item  clearfix">
                        <div class="heading">
                          <a href="#" class="text-danger pull-left">
                            <i class="pg-icon m-r-10">alert_warning</i>
                            <span class="bold">40 days remaining to exam</span>
                            <!-- <span class="fs-12 m-l-10">Take Action</span> -->
                          </a>
                          <span class="pull-right time">2 mins ago</span>
                        </div>
                        <!-- START Notification Item Right Side-->
                        <div class="option">
                          <a href="#" class="mark"></a>
                        </div>
                        <!-- END Notification Item Right Side-->
                      </div>
                      <!-- END Notification Item-->
                    </div>

                    <?php endforeach; ?>
                                        <?php
                                    }
                                    ?>