[Help] With PHP Top Players page.

12/11/2008 23:33 Beta Limit#1
Ok i downloaded a register/top players website source by scottdavey [Only registered and activated users can see links. Click Here To Register...]

It Shows the Top player for different thing, How would i go about adding the Top 3 or top 30 etc?

I'm not very good with PHP so i have no idea about this, i had a little mess around with it yesterday but anything i tried stopped it displaying anything.
12/12/2008 14:33 turk55#2
there was a basic one posted by scottdavey here is the link to it :

[Only registered and activated users can see links. Click Here To Register...]
12/12/2008 15:26 Beta Limit#3
ok yeah thats the one i got but in that it only shows THE top person, what i want to do is show Top 10 or 30. Thats the help im asking for here
12/12/2008 15:28 turk55#4
i c
12/12/2008 20:04 ph03nixx#5
dude how do i start the site?
12/12/2008 22:45 sherwin9#6
ph03nixx, please keep to this thread, if you want to know how to start the site, try to learn ´HOW TO READ´.

Ciao
12/13/2008 19:07 Beta Limit#7
Bumping thread so i dont need to make a new one, Still need help with this.
12/13/2008 22:36 Incariuz#8
I honestly don't know much about PHP, but it's ussually as simple as just reading to figure out what you need to change. I'll add the top players to my site and see if I can figure it out, I think I already have an idea of what it is. So I may be back editting this post, or making a new one in a few minutes.

Edit: Ok, well I tested it, but my idea didn't seem to work. However, the top players doesn't seem to gather information correctly, so... That's something else that would need to be worked on.
12/13/2008 23:33 Beta Limit#9
Quote:
Originally Posted by Incariuz View Post
I honestly don't know much about PHP, but it's ussually as simple as just reading to figure out what you need to change. I'll add the top players to my site and see if I can figure it out, I think I already have an idea of what it is. So I may be back editting this post, or making a new one in a few minutes.

Edit: Ok, well I tested it, but my idea didn't seem to work. However, the top players doesn't seem to gather information correctly, so... That's something else that would need to be worked on.
yeah it needed a bit of editting

Code:
$res = mysql_query("SELECT CharName FROM characters ORDER BY Level DESC ;");
$res2 = mysql_query("SELECT Level FROM characters ORDER BY [U]Level[/U] DESC ;");
Underlined was edit made by me to make it right

and

Code:
$res = mysql_query("SELECT CharName FROM characters ORDER BY CPs DESC ;");
$res2 = mysql_query("SELECT CPs FROM characters ORDER BY [U]CPs[/U] DESC ;");
underlined editted here too.

Just need to get the next rows or something i dont know
12/14/2008 00:19 tanelipe#10
Code:
$res = mysql_query("SELECT CharName FROM characters ORDER BY CPs DESC ;");
$res2 = mysql_query("SELECT CPs FROM characters ORDER BY CPs DESC ;");
Doesn't it have like,
Code:
LIMIT x
so something like...

Code:
$res = mysql_query("SELECT CharName FROM characters ORDER BY CPs DESC LIMIT 10;");
$res2 = mysql_query("SELECT CPs FROM characters ORDER BY CPs DESC LIMIT 10;");
then just, .res2[0,1,2,3,4...etc]
12/14/2008 00:27 nTL3fTy#11
Code:
SELECT `CharName`,`Level` FROM `characters` WHERE `Job` BETWEEN 40 AND 45 ORDER BY `Level` DESC LIMIT 10;
12/14/2008 00:27 Beta Limit#12
@Tanelipe, i tried that but the next values just show up as blank.

@nTL3fTy, will try that right now :)

EDIT: Didnt work, just blank spaces again :(
12/14/2008 03:16 Incariuz#13
Quote:
Originally Posted by Beta Limit View Post
yeah it needed a bit of editting

Code:
$res = mysql_query("SELECT CharName FROM characters ORDER BY Level DESC ;");
$res2 = mysql_query("SELECT Level FROM characters ORDER BY [U]Level[/U] DESC ;");
Underlined was edit made by me to make it right

and

Code:
$res = mysql_query("SELECT CharName FROM characters ORDER BY CPs DESC ;");
$res2 = mysql_query("SELECT CPs FROM characters ORDER BY [U]CPs[/U] DESC ;");
underlined editted here too.

Just need to get the next rows or something i dont know
Ah, ok, didn't think of that, saw it, and was like huh... how does that make sense, lol, but didn't think to change it. Anyway, taking a break from quest making for a few, so I'll take a look at this again and see if I can find a way to make it work...
12/14/2008 12:02 nTL3fTy#14
Here's an example, using my query with an added inner query to remove the high level accounts that are GMs. Of course, you will need to modify it to make it prettier as right now it only prints the data plainly. Hopefully you get the idea.

PHP Code:
<?php
$con 
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("coproj");
$query mysql_real_escape_string("SELECT `CharName`,`Level` FROM `characters` WHERE `Job` BETWEEN 10 AND 15 AND `Account` NOT IN(SELECT `AccountID` FROM `accounts` WHERE `Status`>0) ORDER BY `Level` DESC LIMIT 10;");
$res mysql_query($query);
echo(
"Top Trojans<br />");
while (
$row mysql_fetch_array($resMYSQL_ASSOC)) {
    
printf("Character: %s  Level: %s"$row["CharName"], $row["Level"]);
    echo(
"<br />");
}
$query mysql_real_escape_string("SELECT `CharName`,`Level` FROM `characters` WHERE `Job` BETWEEN 20 AND 25 AND `Account` NOT IN(SELECT `AccountID` FROM `accounts` WHERE `Status`>0) ORDER BY `Level` DESC LIMIT 10;");
$res mysql_query($query);
echo(
"<br />");
echo(
"Top Warriors<br />");
while (
$row mysql_fetch_array($resMYSQL_ASSOC)) {
    
printf("Character: %s  Level: %s"$row["CharName"], $row["Level"]);
    echo(
"<br />");
}
mysql_free_result($res);
?>
12/14/2008 12:03 Beta Limit#15
Quote:
Originally Posted by Incariuz View Post
Ah, ok, didn't think of that, saw it, and was like huh... how does that make sense, lol, but didn't think to change it. Anyway, taking a break from quest making for a few, so I'll take a look at this again and see if I can find a way to make it work...

Good luck :D

Quote:
Originally Posted by nTL3fTy View Post
Here's an example, using my query with an added inner query to remove the high level accounts that are GMs. Of course, you will need to modify it to make it prettier as right now it only prints the data plainly. Hopefully you get the idea.
Thank you so much it worked you are a genius :)