cahyadsn

loop notif

Jul 6th, 2020
879
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. <?php appHeader(1, $page); ?>
  2. <div id="appCapsule">
  3.     <?php
  4.     $notify = DB("SELECT * FROM users_notification WHERE uid = '$user_id' ORDER BY created_at DESC");
  5.     $created_at = '';
  6.     $yesterday  = date('Y-m-d', strtotime("-1 day", strtotime(date('Y-m-d'))));
  7.     while($data_notify = $notify->fetch_assoc()) {      
  8.         $tgl_db=date('Y-m-d',strtotime($data_notify['created_at']));
  9.         if($created_at!=$tgl_db){
  10.             if(date('Y-m-d')==$tgl_db){
  11.                $waktu='Hari ini';
  12.             }else if($yesterday==$tgl_db){
  13.                $waktu='Kemarin';
  14.             } else {
  15.                 $waktu=str_replace(substr(format_date('id', $created_at), -5), '', format_date('id', $created_at));
  16.             }
  17.             $created_at=$tgl_db;
  18.     ?>
  19.     <div class="section pt-2 pb-1">
  20.         <div class="text-secondary" style="font-weight: bold"><?= $waktu; ?></div>
  21.     </div>
  22.     <?php } ?>
  23.     <div class="notification-item">
  24.         <div class="icon-box bg-primary avatar">
  25.             <ion-icon role="img" class="icon hw-icon hw ni-wallet-out md hydrated" aria-label="albums outline"></ion-icon>
  26.         </div>
  27.         <div class="content">
  28.             <div class="notification-divider">
  29.                 <?= $data_notify['created_at'];?>
  30.             </div>
  31.             <div class="bubble">
  32.                 <?= $data_notify['notification'];?>
  33.             </div>
  34.         </div>
  35.     </div>
  36.     <?php } ?>
  37. </div>
Advertisement
Add Comment
Please, Sign In to add comment