Display 3 items

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mademokid
Forum Commoner
Posts: 25
Joined: Tue Jul 10, 2007 11:10 am

Display 3 items

Post by mademokid »

I'm working on an announcements script, and I need a way where

Code: Select all

SELECT * FROM announce ORDER BY date DESC
only grabs the latest 3 announcements.

Any help appreciated!
staar2
Forum Commoner
Posts: 83
Joined: Fri Apr 06, 2007 2:57 am

Re: Display 3 items

Post by staar2 »

add in the end of query LIMIT 3
mademokid
Forum Commoner
Posts: 25
Joined: Tue Jul 10, 2007 11:10 am

Re: Display 3 items

Post by mademokid »

Thanks star, it works!
Etamnanki
Forum Newbie
Posts: 4
Joined: Sun Feb 17, 2008 9:46 pm

Re: Display 3 items

Post by Etamnanki »

LIMIT 3? Well, you could give it a try... no?

SELECT * FROM announce ORDER BY date DESC
LIMIT 3;

I think. Well, that's what conventional wisdom would say, no? I'm not too confident in my scripting abilities, but doesn't hurt to give it a shot. 8O

(Oops, too late...)
Post Reply