Jump to content

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...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.