Davie33 Posted September 13, 2011 Share Posted September 13, 2011 i have a ranking code and i would like to know how i can add another $rquery. $ranking = array(); $rquery = yasDB_select("SELECT username FROM user ORDER BY plays"); // only way to rank I see is by plays which you can use to count comments/user submissions $i=0; while ($rank = $rquery->fetch_array(MYSQLI_ASSOC)) { $ranking[$i] = $rank['username']; $i++; } $rank = array_search($username,$ranking)+1; What i mean is this code here is giving a member a rank to how many games they have play. so say a member played 102 game and the other member played 94.Member one would be rank 1 and 2nd member is rank 2 how do i add another sql to it so it will do the same for this sql ? CREATE TABLE IF NOT EXISTS `topic` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userid` int(11) NOT NULL DEFAULT '0', `ipaddress` varchar(255) NOT NULL DEFAULT '', `comment` text NOT NULL, `name` varchar(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; Quote Link to comment Share on other sites More sharing options...
fenway Posted September 13, 2011 Share Posted September 13, 2011 You're trying to assign rank in mysql? There are dozens of tutorials. You're just asking for a counter, right? Quote Link to comment Share on other sites More sharing options...
Davie33 Posted September 13, 2011 Author Share Posted September 13, 2011 You're just asking for a counter, right? yip just the counter. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 14, 2011 Share Posted September 14, 2011 Then you might as well number them in PHP -- or, if you insist, use user variables in mysql. Quote Link to comment Share on other sites More sharing options...
Davie33 Posted September 16, 2011 Author Share Posted September 16, 2011 Hi can i pm u with the full code to what am trying to do ?. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 16, 2011 Share Posted September 16, 2011 Hi can i pm u with the full code to what am trying to do ?. No, I don't provide "full code". There are countless examples on this forum of using user variables as counters. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.