Flipe.NET
01-22-2007, 04:19 PM
I have a TABLE like this:
rid login pos pnt rank
1001 Paulo 1 55,20 Domingo
1001 Pablao 2 45,60 Domingo
1001 Head_Neck 3 36,00 Domingo
1001 Panstro 4 28,80 Domingo
1001 MUSH_PILLS 5 21,60 Domingo
1001 Romulo 6 16,80 Domingo
1001 Yo 7 12,00 Domingo
1001 Henry 8 9,60 Domingo
1001 Rodrigao 9 7,20 Domingo
1001 Luciano 10 7,20 Domingo
1001 Ximbao 11 0,00 Domingo
1001 George 12 0,00 Domingo
1002 Levy 1 73,60 Segunda
1002 Belo 2 60,80 Segunda
1002 Rodrigao 3 48,00 Segunda
1002 Alex_CTBA 4 38,40 Segunda
1002 Chimbica 5 28,80 Segunda
1002 PEXERO 6 22,40 Segunda
1002 RM 7 16,00 Segunda
1002 Rodrigo_CTBA 8 12,80 Segunda
1002 Head_Neck 9 9,60 Segunda
1002 MUSH_PILLS 10 9,60 Segunda
1002 Yo 11 0,00 Segunda
1002 Ximbao 12 0,00 Segunda
1002 M.Fagundes 13 0,00 Segunda
1002 Malvezzi 14 0,00 Segunda
1002 Pablao 15 0,00 Segunda
1002 George 16 0,00 Segunda
i want to filter the RANK collum and pick DISTINT login. Ok
i want that every login plus their points. Ok
i want to ORDER that in ASC, like more to less. Dont work now because if i put more results on table, the ORDER will be from first MYSQL query.
CODE:
function verrank($rankde){
if($rankde=="Segunda"){
$SEGa = "SELECT DISTINCT `login` FROM `pontos` WHERE `rank` LIKE 'Segunda'";
$rSEGa = @mysql_query($SEGa) or error("Erro no SQL Seg!");
//$ddra = mysql_fetch_array($rSEGa);
while($ddra = mysql_fetch_array($rSEGa)){
$llg = $ddra["login"];
$SEGb = mysql_query("SELECT * FROM pontos WHERE rank='Segunda' AND login='$llg'");
$pontos = 0;
$jogou = mysql_num_rows($SEGb);
while($rSEGb = mysql_fetch_array($SEGb)){
$pontos = $pontos+$rSEGb["pnt"];
}
$mpnt = $pontos / $jogou;
echo"$SEGb -> $llg jogou $jogou jogos. Fez um total de $pontos. Com média de $mpnt<br>";
}
}
}
SITE:
http://www.pokerjoinville.com.br/?op=rank&acao=verrank&rankde=Segunda
Thanks!
rid login pos pnt rank
1001 Paulo 1 55,20 Domingo
1001 Pablao 2 45,60 Domingo
1001 Head_Neck 3 36,00 Domingo
1001 Panstro 4 28,80 Domingo
1001 MUSH_PILLS 5 21,60 Domingo
1001 Romulo 6 16,80 Domingo
1001 Yo 7 12,00 Domingo
1001 Henry 8 9,60 Domingo
1001 Rodrigao 9 7,20 Domingo
1001 Luciano 10 7,20 Domingo
1001 Ximbao 11 0,00 Domingo
1001 George 12 0,00 Domingo
1002 Levy 1 73,60 Segunda
1002 Belo 2 60,80 Segunda
1002 Rodrigao 3 48,00 Segunda
1002 Alex_CTBA 4 38,40 Segunda
1002 Chimbica 5 28,80 Segunda
1002 PEXERO 6 22,40 Segunda
1002 RM 7 16,00 Segunda
1002 Rodrigo_CTBA 8 12,80 Segunda
1002 Head_Neck 9 9,60 Segunda
1002 MUSH_PILLS 10 9,60 Segunda
1002 Yo 11 0,00 Segunda
1002 Ximbao 12 0,00 Segunda
1002 M.Fagundes 13 0,00 Segunda
1002 Malvezzi 14 0,00 Segunda
1002 Pablao 15 0,00 Segunda
1002 George 16 0,00 Segunda
i want to filter the RANK collum and pick DISTINT login. Ok
i want that every login plus their points. Ok
i want to ORDER that in ASC, like more to less. Dont work now because if i put more results on table, the ORDER will be from first MYSQL query.
CODE:
function verrank($rankde){
if($rankde=="Segunda"){
$SEGa = "SELECT DISTINCT `login` FROM `pontos` WHERE `rank` LIKE 'Segunda'";
$rSEGa = @mysql_query($SEGa) or error("Erro no SQL Seg!");
//$ddra = mysql_fetch_array($rSEGa);
while($ddra = mysql_fetch_array($rSEGa)){
$llg = $ddra["login"];
$SEGb = mysql_query("SELECT * FROM pontos WHERE rank='Segunda' AND login='$llg'");
$pontos = 0;
$jogou = mysql_num_rows($SEGb);
while($rSEGb = mysql_fetch_array($SEGb)){
$pontos = $pontos+$rSEGb["pnt"];
}
$mpnt = $pontos / $jogou;
echo"$SEGb -> $llg jogou $jogou jogos. Fez um total de $pontos. Com média de $mpnt<br>";
}
}
}
SITE:
http://www.pokerjoinville.com.br/?op=rank&acao=verrank&rankde=Segunda
Thanks!
