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/main_news.php
<?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 c.id = 4 order by unix_timestamp(date_published) desc LIMIT 1");
              $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 % 3 == 1 && $count > 1) {
                        echo '</div><div class="col-lg-4 border-start custom-border">';
                      }
                
            ?>

<div class="col-lg-4">
            <div class="post-entry-1 lg">
              <a href="./index.php?page=read_news&c=<?php echo md5($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"></span><?php echo $row['category'] ?> <span class="mx-1">&bullet;</span> <span><?php echo $date_published ?></span></div>
              <h3><a href="./index.php?page=read_news&c=<?php echo md5($row['id']) ?>"><?php echo $row['title'] ?></a></h3>
              <!--p class="mb-4 d-block"><?php //echo strip_tags($desc) ?></p-->

              <!--div class="d-flex align-items-center author">
                <div class="photo"><img src="assets/img/person-1.jpg" alt="" class="img-fluid"></div>
                <div class="name">
                  <h3 class="m-0 p-0">Cameron Williamson</h3>
                </div>
              </div-->
            </div>
        </div>

        <?php    endwhile;     endif;?>