-2

How can I display the last 3 or 5 records in my case posts (my columns in database are post_id, post_title, post_date, post_text) in HTML page but in table?

I suppose I know to display records in table but how to edit style of the table, where? I am talking about displaying just last 3 or 5 records not all records from database.

halfer
  • 19,824
  • 17
  • 99
  • 186
sake96
  • 1
  • 1

1 Answers1

2

I suppose something like this. Naturally, replace table with your table. Also this question has been asked a million times before here.

SELECT * FROM (
    SELECT * FROM table ORDER BY post_id DESC LIMIT 5
    )
    ORDER BY post_id ASC;
Sorin Lascu
  • 395
  • 1
  • 4
  • 15