tags:

views:

36

answers:

1

I have a news script. This script works like the following:

  1. I enter the news details from a form
  2. The news is inserted into the database
  3. The news is displayed to the visitor

I need to display the latest 4 news only, not all news entries. How can I do this?

+4  A: 

Make your query like this:

SELECT * FROM news ORDER BY news_id DESC LIMIT 4

where news_id is the primary key of your news table.

Sarfraz
...Assuming MYSQL is used for the database
gt
@gt: Yeah that is pretty much assumed there :)
Sarfraz