dean7 Posted April 16, 2010 Share Posted April 16, 2010 Hi all, I want to create something for my website which shows the user with the most money etc... So the user with the most cash in the game would be first on the blacklist the the person with then 2nd most cash would be 2nd on the blacklist etc.. But how could i code this? Thanks for your help. Link to comment https://forums.phpfreaks.com/topic/198784-blacklists/ Share on other sites More sharing options...
Ken2k7 Posted April 16, 2010 Share Posted April 16, 2010 A simple database table that keeps track of who has what. Then query it. Do you have a more specific question that I can give a more specific response to? Link to comment https://forums.phpfreaks.com/topic/198784-blacklists/#findComment-1043294 Share on other sites More sharing options...
Pikachu2000 Posted April 16, 2010 Share Posted April 16, 2010 Assuming this is database driven: "SELECT username FROM table ORDER BY money DESC" would return the results you need. Link to comment https://forums.phpfreaks.com/topic/198784-blacklists/#findComment-1043296 Share on other sites More sharing options...
dean7 Posted April 16, 2010 Author Share Posted April 16, 2010 Assuming this is database driven: "SELECT username FROM table ORDER BY money DESC" would return the results you need. But from that how would I display it in a table with the person with most money at the top? Link to comment https://forums.phpfreaks.com/topic/198784-blacklists/#findComment-1043297 Share on other sites More sharing options...
Pikachu2000 Posted April 16, 2010 Share Posted April 16, 2010 The ORDER BY clause sorts it by the field specified, then the DESC parameter sorts it in descending order. You'd just echo it out in a while{} loop as you would any other time. Link to comment https://forums.phpfreaks.com/topic/198784-blacklists/#findComment-1043322 Share on other sites More sharing options...
dean7 Posted April 16, 2010 Author Share Posted April 16, 2010 The ORDER BY clause sorts it by the field specified, then the DESC parameter sorts it in descending order. You'd just echo it out in a while{} loop as you would any other time. Ok thanks . Ill give it a go Link to comment https://forums.phpfreaks.com/topic/198784-blacklists/#findComment-1043330 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.