HEX
Server: LiteSpeed
System: Linux premium313.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User: wekawqug (1662)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/wekawqug/ndondocup.sisihub.co.tz/recommended.php
          <div class="col-lg-4 border-start custom-border">
          <?php
            $where = '';
            $count = 0; // Initialize counter
            if(isset($_GET['q'])){
               $where = " and md5(p.category_id) = '{$_GET['q']}' ";

            }
              $news = $conn->query("SELECT p.*,c.category from post_list p inner join category_list c on c.id = p.category_id where status = 1 $where AND p.recommended = 1 order by unix_timestamp(date_published) desc LIMIT 4");
              $count = 0; // Initialize counter
              if($news->num_rows > 0):
                while($row = $news->fetch_assoc()):
                  // Format date_published to display only the date part (YYYY-MM-DD)
                  $date_published = date('F j, Y', strtotime($row['date_published']));

                  $trans = get_html_translation_table(HTML_ENTITIES,ENT_QUOTES);
                    unset($trans["\""], $trans["<"], $trans[">"], $trans["<h2"]);
                    $desc = strtr(html_entity_decode($row['content']),$trans);
                    $desc=str_replace(array("<li>","</li>"), array("",", "), $desc);
                    // Increment counter
                      $count++;
                      // Display border after every 3 results
                      if($count % 2 == 1 && $count > 1) {
                        echo '</div><div class="col-lg-4 border-start custom-border">';
                      }
                
            ?>
            <!--START DISPLAYING NEWS-->    
              <div class="post-entry-1">
                <a href="./index.php?page=read_news&c=<?php echo md5($row['id']) ?>" data-id = '<?php echo $row['id'] ?>'><img src="assets/uploads/content_images/<?php echo $row['cover_img'] ?>" alt="" class="img-fluid"></a>
                <div class="post-meta"><span class="date">recommended</span> <span class="mx-1">&bullet;</span> <span><?php echo $date_published ?></span></div>
                <h2><a href="./index.php?page=read_news&c=<?php echo md5($row['id']) ?>" data-id = '<?php echo $row['id'] ?>'><?php echo $row['title'] ?></a></h2>
              </div>            
            <?php    endwhile;     endif;?>
            </div>