如何从博客列表中跳过前三个帖子?

时间:2017-07-01 14:40:08

标签: php mysql post

嗨,谁知道如何从博客列表中跳过前三个帖子,因为我希望前三个被列在最顶层...?

<?php 

$query = "SELECT * FROM posts ";
$select_all_posts_query = mysqli_query($connection,$query);

while($row = mysqli_fetch_assoc($select_all_posts_query)){
    $post_id = $row['post_id'];
    $post_title = $row['post_title'];
    $post_author = $row['post_author'];
    $post_date = $row['post_date'];
    $post_image = $row['post_image'];
    $post_content = substr($row['post_content'],0,255);
    $post_status = $row['post_status'];

    if($post_status !== 'published') {

        echo "<h1 class='text-center'> NO POST SORRY</h1>";

    } else {

    }
}
?>

1 个答案:

答案 0 :(得分:2)

使用

LIMIT 3, X

哪个X是你的限制

所以查询必须是

$query = "SELECT * FROM posts LIMIT 3, X";

如果你想从3获得所有,那么应该是18446744073709551615(MYISAM的最大行 - 来自stackoverflow ... lol)