In a database, is a table, atable, with 3 columns, id (autoincremented), title, and description.
How can you get the last 6 rows in the table and post the data as below:
<div class="myclass">
<h1>Title</h1>
<p>Description</p>
</div>
The SQL you are looking for is like this:
SELECT Title, Description
FROM aTable
ORDER BY ID Desc
LIMIT 6
ORDER BY
the ID and then use LIMIT
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.