Records Displayed

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
mit123
Forum Newbie
Posts: 3
Joined: Sat Jul 30, 2005 10:38 am

Records Displayed

Post by mit123 »

Hi, I am trying to display some records from a mysql database into a php page. It is a list of people, position etc and their salary. I need a php or mysql code which will display only the first 5 people with the highest salary, thereby not showing any of the other records on the database.

Any help from members on this forum would be greatly appreciated as I desperately need to get it to work.

Thanks
User avatar
harrisonad
Forum Contributor
Posts: 288
Joined: Fri Oct 15, 2004 4:58 am
Location: Philippines
Contact:

Post by harrisonad »

Code: Select all

$query = "
SELECT * FROM tablename
ORDER BY salary DESC LIMIT 5";
Post Reply