如何在MySQL表上选择特定行?

I have a table called 'topics' in which all topics are saved. I want to select the latest 5 rows from that table, show them on one page, then select THE OTHER FIVE latest ones and show them on the other page.

I know how to echo all the topic names in a while loop, but the problem here is making mysql select 5 rows, then the other five for another page, not the same ones again. How to achieve this?

SELECT
*
FROM tablename
ORDER BY id DESC
LIMIT 0, 5

on the another page:

LIMIT 5, 5
$start = 0;
$count= 5;
$query = "select *
    from topics
    order by date desc
    limit $start, $count"

First 5:

SELECT * FROM your_table ORDER BY any_order_criteria LIMIT 0,5

Second 5:

SELECT * FROM your_table ORDER BY any_order_criteria LIMIT 5,5

What i got from your problem is that you want to enable Pagination on your page.

This is a wonderful article on Pagination using PHP and MySQL.

http://www.tonymarston.net/php-mysql/pagination.html