Sorting and echoing from db

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
tonchily
Forum Commoner
Posts: 54
Joined: Thu Sep 02, 2010 10:44 am

Sorting and echoing from db

Post by tonchily »

So, I got the following fields in my db:
name, number

and I have 15 entries as it follows:
John, 15
Jamie, 11
Jessica, 24
Jaspergod, 51
Tony, 33
Michael, 51
Ninna, 55
Anamaria, 66
Alison, 54
Andrzej, 61
Leslie, 26
Trevor, 86
Wayne, 42
Abraham, 21
Morris, 95

and I want to echo out the top5 names sorted by numbers descending. How can I do that? Thank you.
tonchily
Forum Commoner
Posts: 54
Joined: Thu Sep 02, 2010 10:44 am

Re: Sorting and echoing from db

Post by tonchily »

Nevermind, the "LIMIT" did it all.
Post Reply