Tim
Tim

Reputation: 71

Display 10 most recent database entries in a HTML table

I'm working on a PHP application, where I need to display the 10 most recent MySQL database entries in a HTML table.

I'm not too sure how I'd go about doing this.

My database holds the date the item was submitted, and the time (in separate columns).

How would I retrieve the 10 most recent database entries in a HTML table?

Edit: Is it possible using ajax?

Upvotes: 0

Views: 395

Answers (2)

Boopathi Rajan
Boopathi Rajan

Reputation: 1210

try this

SELECT *
FROM table
ORDER BY id DESC limit 10

Upvotes: 3

Mikpa
Mikpa

Reputation: 1922

Maybe like this:

SELECT some, colums
FROM table
ORDER BY submitdate DESC, submittime DESC
LIMIT 10

Upvotes: 1

Related Questions