Jump to content

array question


karimali831

Recommended Posts

Hi

 

I'm looking something simular to this:

http://cupaddon.com/index.php?site=halloffame

 

Under the place column, it shows

 

#1

#2

#3

 

for each row.

 

How can I use php to use this on my table for each row?

And please say if this question makes no sense to you.

 

I simply want to use

 

#1

#2

etc for each of my rows for my table.

 

I am using a while loop for my table also.

 

I really appreciate if anyone can help me on this, thanks very much!

Link to comment
https://forums.phpfreaks.com/topic/210060-array-question/
Share on other sites

$getladders = safe_query("SELECT * FROM ".PREFIX."cup_ladders WHERE ID='$laddID'");
if(!mysql_num_rows($getladders)) { echo 'No ladders for '.getplatname($platID).'';
  }else
  
  $ds=mysql_fetch_array(safe_query("SELECT platID FROM ".PREFIX."cup_ladders WHERE ID='$laddID'"));
  
echo '
  <table width="100%" bordercolor="'.$border.'">
   <tr>
    <td width="25%" align="left" class="title" colspan="7">  &#8226; Standings</td>
    <td width="25%" align="center" class="title" colspan="3">
     <a href="?site=ladders&platID='.$ds['platID'].'"><img border="0" width="16" height=16" src="images/cup/icons/goback.png"> <b>Ladders</b></a> |
     <a href="?site=matches&laddID='.$laddID.'"><b>Matches</b> <img border="0" width="16" height=16" src="images/cup/icons/goforward.png"></a></td>
   </tr>
   <tr>
    <td width="5%"  bgcolor="'.$bg1.'" class="title2" align="center">Rank:</td>
    <td width="10%" bgcolor="'.$bg1.'" class="title2" align="center">Teamname:</td>
    <td width="10%" bgcolor="'.$bg1.'" class="title2" align="center">XP:</td>
    <td width="10%" bgcolor="'.$bg1.'" class="title2" align="center">Activity:</td>
    <td width="10%" bgcolor="'.$bg1.'" class="title2" align="center">Won:</td>
    <td width="10%" bgcolor="'.$bg1.'" class="title2" align="center">Draw:</td>
    <td width="10%" bgcolor="'.$bg1.'" class="title2" align="center">Lost:</td>
    <td width="10%" bgcolor="'.$bg1.'" class="title2" align="center">Streak:</td>
    <td width="10%" bgcolor="'.$bg1.'" class="title2" align="center">Ratio:</td>
    <td width="10%" bgcolor="'.$bg1.'" class="title2" align="center">Challenge:</td>
   </tr>';
   
while($ld=mysql_fetch_array($getladders)) { $laddID = $ld['ID'];
  if(ladderis1on1($laddID)) {
   $participants = safe_query("SELECT * FROM ".PREFIX."cup_clans WHERE ladID='$laddID' AND 1on1='1'");
    }else
   $participants = safe_query("SELECT * FROM ".PREFIX."cup_clans WHERE ladID='$laddID' AND 1on1='0'");
while($ds=mysql_fetch_array($participants)) { $teamID = $ds['clanID'];

if(ladderis1on1($ds['ladID'])) {

echo '
   <tr>
    <td bgcolor="'.$bg1.'" width="5%"  align="center">#'.$rank.'</td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"><a href="?site=profile&id='.$ds['clanID'].'">'.getnickname($ds['clanID']).'</a></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
   </tr>
<br>';

}else{

echo '
   <tr>
    <td bgcolor="'.$bg1.'" width="5%"  align="center">#'.$rank.'</td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"><a href="?site=clans&action=show&clanID='.$ds['clanID'].'">'.getclanname($teamID).'</a></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
    <td bgcolor="'.$bg1.'" width="10%" align="center"></td>
   </tr>
<br>';

      } 
    } 
  }echo '</table>';

 

Have nothing for $rank, that's what I want: $rank = #1, #2 etc

 

Thank you!

Link to comment
https://forums.phpfreaks.com/topic/210060-array-question/#findComment-1096290
Share on other sites

  • 2 weeks later...

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.