komquat Posted February 28, 2006 Share Posted February 28, 2006 It is a pretty simple thing, or at least I thought, but I can not remember how to get sequential numbersEx.1 A2 B3 C4 DI think it is something likecount=($i = '1', $i++);Help or direction on this would be great.Thanks Quote Link to comment Share on other sites More sharing options...
obsidian Posted February 28, 2006 Share Posted February 28, 2006 are you just referring to for()?[code]<?phpfor ($i = 1; $i <= 10; $i++) echo $i . "<br />\n";?>[/code] Quote Link to comment Share on other sites More sharing options...
komquat Posted February 28, 2006 Author Share Posted February 28, 2006 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]<?phpfor ($i = 1; $i <= 19; $i++)//Loop is herewhile(Somefunction Here) {<td>$i</td><td>$player</td><td>$points</td>}?>[/code]Would I need a ';' after the for() statement? Quote Link to comment Share on other sites More sharing options...
kanikilu Posted February 28, 2006 Share Posted February 28, 2006 [code]<?phpfor ($i = 1; $i <= 19; $i++) { echo "<td>$i</td><td>$player</td><td>$points</td>";}?>[/code] Quote Link to comment Share on other sites More sharing options...
komquat Posted February 28, 2006 Author Share Posted February 28, 2006 [!--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]<?phpfor ($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? Quote Link to comment Share on other sites More sharing options...
AndyB Posted February 28, 2006 Share Posted February 28, 2006 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 Link to comment Share on other sites More sharing options...
komquat Posted February 28, 2006 Author Share Posted February 28, 2006 [!--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 10Bob 12Tony 14John 22I want them to have a rank in front of them. Quote Link to comment Share on other sites More sharing options...
komquat Posted February 28, 2006 Author Share Posted February 28, 2006 I figured it out.thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.