php - Stop posts from being displayed after certain day -


i have created pagination function travel company. there 2 things want change can't figure out.

  1. each trip has date. want able stop trip displaying in list 1 day of trip , subsequent days. have rough idea, doesn't seem work.
if (date($row['date'])  getdate()) {     // echo trip info here } 

-2. after each of trips in list there seperator (is right word?) separate each trip's info. on last trip if page don't want seperator. have no clue how :/

thanks in advance & advice.

                    <?php                  if (isset($_get["p"])) { $page  = $_get["p"]; } else { $page=1; };                  $start_from = ($page-1) * 4;                  $sql = "select * destinations order date asc limit $start_from, 4";                  $result = mysqli_query ($con,$sql);    while($row = mysqli_fetch_array($result))   {  echo "<div class='row'>";             echo "<div class='col-md-4 col-sm-4'>";                     echo "<img src='" . $row ['img'] . "' alt='' class='img-responsive'>";                 echo "</div>";                 echo "<div class='col-md-8 col-sm-8'>";                     echo "<h2><a href='" . $row ['url'] . "'>" . $row ['name'] . "</a></h2>";                     echo "<ul class='blog-info'>";                         echo "<li><i class='icon-calendar'></i> " . date("d/m/y", strtotime($row['date'])) . "</li>";                     echo "</ul>";                    echo $row ['description'];                     echo "<a class='btn theme-btn' href='" . $row ['url'] . "'>view details <i class='icon-angle-right'></i></a>";                 echo "</div>";             echo "</div>";             echo "<hr class='blog-post-sep'>";   }  $sql = "select count(trip_id) destinations";  $result = mysqli_query($con,$sql);  $row = mysqli_fetch_row($result);  $total_records = $row[0];  $total_pages = ceil($total_records / 4);   echo "<div class='text-center'> <ul class='pagination pagination-centered'>"; ($i=1; $i<=$total_pages; $i++) {              echo "<li><a href='routea.php?p=".$i."'>".$i."</a></li>";  }; echo "</ul></div>"; 

mysqli_close($con); ?>

  1. change sql filter out unwanted trips:

    select * destinations date  < current_date() order date asc  limit $start_from, 4 
  2. you can solve css:

    hr.blog-post-sep:last-of-type {     display: none; } 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -