Please help me how to display by id so that when the number id grew the id-2 post was displayed so that SELECT * FROM chess WHERE id = $ id-2 was obtained
<div class="postblock"> <?php $articles = mysqli_query($link,"SELECT * FROM chess WHERE id < 5 ORDER BY id DESC LIMIT 5"); ?> <?php WHILE( $art = mysqli_fetch_assoc($articles) ){ ?> <div class="post"> <a href="http://localhost/madbet/posts"><img src="http://localhost/madbet/img/images/chess/<?php echo $art['image-1'] ?>"></a> <p><i class="fa fa-clock-o" aria-hidden="true"></i><?php echo date_create($art['pubdate'])->Format('H:i');?></p> <a href="http://localhost/madbet/posts"><h1><?php echo mb_substr($art['title'],0,33)?></h1></a> <h4 style="margin-bottom:40px;"><?php echo mb_substr($art['text-1'],0,140).'...';?></h4> </div> <?php } ?> </div>
id=id-2<- this is definitely unearthly math! - Visman Sep.SELECT c1.* FROM chess c1 inner join chess c2 on c1.id = c2.id - 2- Qwertiy ♦