Jump to content

need help to finish this!!!!


buladex

Recommended Posts

on site page i made this :

 

Rank 	Name  	Wons  	Lost
1. 	Alexutzu 	0047 	
2. 	test145[PM] 	0001 

 

 

script for that is:

 

<tr>
    <td width="*" align="center">Rank</td>                                       
    <td width="*" align="center"><font color="#000000">Name</td>
    <td width="*" align="center"><font color="#000000">Wons</td>
<td width="*" align="center"><font color="#000000">Lost</td>

  </tr>
  
<?php				
$rank = mysql_query('SELECT player_name,data FROM xxxx WHERE event_type= 971'
      .' ORDER by data desc LIMIT '.$limit.';');
$i=1;
while ($row = mysql_fetch_array($rank)) {
	echo '<tr><td align="center">'.$i.'.</td>
      <td align="center"><font color="#0000FF">'.$row['player_name'].'</td>
      <td align="center"><font color="#FF0080">'.$row['data'].'</td>
[u]HERE i need lost table which is same as win only event_type= 972 how i do that??[/u]

    </tr> ';
    $i++;
    }

 

so i need lost table!!!

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/207822-need-help-to-finish-this/
Share on other sites

not working so far , i replaced it and i get error at :

 

   while ($row = mysql_fetch_array($rank)) {

 

in:

 

<?php				
$rank = mysql_query('SELECT w.player_name,w.data AS won, l.data AS lost FROM cq_statistic AS w CROSS JOIN cq_statistic AS l USING (player_name) WHERE w.event_type= 971 AND l.event_type = 972'
      .' ORDER by data desc LIMIT '.$limit.';');
$i=1;
while ($row = mysql_fetch_array($rank)) {
	echo '<tr><td align="center">'.$i.'.</td>
      <td align="center"><font color="#0000FF">'.$row['player_name'].'</td>
      <td align="center"><font color="#FF0080">'.$row['data'].'</td>


    </tr> ';
    $i++;
    }

acctualy right is w.data but still not working, got no error but doesnt show won and lost points:

 

 

<?php				
$rank = mysql_query('SELECT w.player_name,w.data AS Won, l.data AS Lost FROM xxxx AS w CROSS JOIN xxxx AS l USING (player_name) WHERE w.event_type= 971 AND l.event_type = 972'
      .' ORDER BY w.data desc LIMIT '.$limit.';');
$i=1;
while ($row = mysql_fetch_array($rank)) {
	echo '<tr><td align="center">'.$i.'.</td>
      <td align="center"><font color="#0000FF">'.$row['player_name'].'</td>
      <td align="center"><font color="#FF0080">'.$row['data'].'</td>

    </tr> ';
    $i++;
    }
?>

 

 

i am :D all script:

 

<div align="center"><font color="#FF0000", size="5px"><b> Top Arena</b></div>

<table<?php echo $tableSet; ?>>
  <tr>
    <td width="*" align="center">Rank</td>                                       
    <td width="*" align="center"><font color="#000000">Name</td>
    <td width="*" align="center"><font color="#000000">Won</td>
<td width="*" align="center"><font color="#000000">Lost</td>

  </tr>
  
<?php				
$rank = mysql_query('SELECT w.player_name,w.data AS Won, l.data AS Lost FROM xxxx AS w CROSS JOIN xxxx AS l USING (player_name) WHERE w.event_type= 971 AND l.event_type = 972'
      .' ORDER BY w.data desc LIMIT '.$limit.';');
$i=1;
while ($row = mysql_fetch_array($rank)) {
	echo '<tr><td align="center">'.$i.'.</td>
      <td align="center"><font color="#0000FF">'.$row['player_name'].'</td>
      <td align="center"><font color="#FF0080">'.$row['data'].'</td>
      <td align="center"><font color="#FF0080">'.$row['Won'].'</td>
     <td align="center"><font color="#FF0080">'.$row['Lost'].'</td>

    </tr> ';
    $i++;
    }
?>
                                                        </tbody></table></td>

 

 

my old script shows this whit 'won' table only which is corect:

 

 

Rank 	Name  	Won
1. 	SPIU[PM] 	0003
2. 	~*CaTHLeeN*~ 	0001

 

whit new script shows :

 

Rank 	Name  	Won 	Lost
1. 	~*CaTHLeeN*~ 	0001 	0001

 

which is corect by points but where is real rank 1 player????????

 

 

Ok, so let's do it so it will display when the player has no wins too:

 

SELECT 
  p.player_name, IFNULL(w.data,0) AS won, IFNULL(l.data,0) AS lost 
FROM (
  SELECT DISTINCT player_name FROM xxxx WHERE event_type IN (971,972)
) AS p
LEFT JOIN (
  SELECT player_name, data FROM xxxx WHERE event_type = 971
) AS w USING (player_name)
LEFT JOIN (
    SELECT player_name, data FROM xxxx WHERE event_type = 972
) AS l USING (player_name)

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.