Jump to content
xisto Community
krap

Ranking System With Mysql Cant think of a way to do it.

Recommended Posts

Ok here's a challenge for those who unlike me are good at php and mysql. I have a mysql database called users which has 2 (relevant) fields username and points which can be added or subtracted depending on how they good they are at rap battling(i run a hiphop forum). I also am going to make a table called crews. each crew will have 10 fields: creator, member1, member2, member3 etc. all the way to member10. Is there a script i could make(or you could make for me if you like reputation :) ) that could count up all the points for all the users in every crew and put them in a league. Eg. If "crew1"'s members all had 10 points and "crew2"'s had 20 each it would look like:1. Crew 2 (200 points)2. Crew 1 (100 points)That would be assuming they had 10 members each.So if you can help or point me in the right direction id be very thankful and forever in you debt..Thanks in advancekrap

Share this post


Link to post
Share on other sites

Hi krap,Am interseted in creating a basic "rep" system for forum members on a friends site.QUESTION: Where did you get the php code for your basic rep system????Can you give me a url/link etc. for it??? OR possibly PM the code to me??Any help appreciatedThanks in advanceRGPHNX

Share this post


Link to post
Share on other sites

use this query:

 

SELECT creator, (crew1 + crew2 + crew3 + crew4 + crew5 + crew6 + crew7 + crew8 + crew9 + crew10) as score FROM crews

68623[/snapback]

I dont understand that code im not very good at mysql querys would i need to add anything to it to show the list i wanted to make?

Share this post


Link to post
Share on other sites

just edit this code for your site:

$sql = "SELECT creator, (crew1 + crew2 + crew3 + crew4 + crew5 + crew6 + crew7 + crew8 + crew9 + crew10) as score    FROM crews";if (!($result = mysql_query($sql))) {    exit(mysql_error() . ' - ' . $sql);}while ($crews[] = mysql_fetch_assoc($result));for ($x = 0; $x < count($crews) - 1; $x++) {    print '1. ' . $crews[$x]['creator'] . ' ' . $crews[$x]['score'];}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.