views:

53

answers:

0

Ok, I have an array outside of the SQL database in the following format:

$currStats['USERNAME'][SKILL NUMBER][1-3]

Username obviously pertains to a specific user, skill number is the number of the skill and 1-3 is either XP, rank or level.

So $currStats['Jimmy93'][0][1] would return the Overall (Skill #0) level of Jimmy93.

Now, that data is outside of the MySQL table and is parsed live when the user loads the page. I need to compare that with data in the MySQL database in the following form:

I need to return the person who has gained the most XP over a set time period for each skill.

I was trying to do this with the MAX() command in SQL but I couldn't get it to work in a loop (I need to do this as quickly/efficiently as possible).

SO, is this possible, and if so, how do I find the highest gainer for each skill by comparing outside data with a row in the database.