Page 1 of 1

Records Displayed

Posted: Sun Aug 28, 2005 7:42 pm
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

Posted: Sun Aug 28, 2005 7:53 pm
by harrisonad

Code: Select all

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