Jump to content

Recommended Posts

I have a table, and I want this to show who is ranked #1 thru rank # 19. I have it in a loop, so I would use it like this
[code]
<?php
for ($i = 1; $i <= 19; $i++)

//Loop is here
while(Somefunction Here) {
<td>$i</td><td>$player</td><td>$points</td>
}

?>
[/code]

Would I need a ';' after the for() statement?
Link to comment
https://forums.phpfreaks.com/topic/3747-counting-1/#findComment-13003
Share on other sites

[!--quoteo(post=350259:date=Feb 28 2006, 11:29 AM:name=kanikilu)--][div class=\'quotetop\']QUOTE(kanikilu @ Feb 28 2006, 11:29 AM) [snapback]350259[/snapback][/div][div class=\'quotemain\'][!--quotec--]
[code]<?php
for ($i = 1; $i <= 19; $i++) {
  echo "<td>$i</td><td>$player</td><td>$points</td>";
}
?>[/code]
[/quote]

How would I put count loop inside of the While loop?
Link to comment
https://forums.phpfreaks.com/topic/3747-counting-1/#findComment-13058
Share on other sites

Wait a minute! Where does the information actually come from about player names and score (or whatever is used to rank them)? If it's from a database then you can construct a single query to retrieve the highest 19 scores, ordered by score .... Bit more information please, then we'll figure out what this has to do with a while loop, or a for loop, or a counter.
Link to comment
https://forums.phpfreaks.com/topic/3747-counting-1/#findComment-13063
Share on other sites

[!--quoteo(post=350299:date=Feb 28 2006, 12:50 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Feb 28 2006, 12:50 PM) [snapback]350299[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Wait a minute! Where does the information actually come from about player names and score (or whatever is used to rank them)? If it's from a database then you can construct a single query to retrieve the highest 19 scores, ordered by score .... Bit more information please, then we'll figure out what this has to do with a while loop, or a for loop, or a counter.
[/quote]

I am getting it from a DB, and I currently do that, but I want a rank for each one as well as the order.

I have:

Andy 10
Bob 12
Tony 14
John 22

I want them to have a rank in front of them.
Link to comment
https://forums.phpfreaks.com/topic/3747-counting-1/#findComment-13066
Share on other sites

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.