Looking to call info from most to least

Hi all, I have a script that ive been working on and in need of help with. I need to show points from most to least per each division.

Here is the code…

[php]

		<div id='standings-east-h'></div>

		<table class='standings'>

			<tr class='dheader'><td colspan='16'>ATLANTIC DIVISION</td></tr>

			<tr class='theader'>

				<td class='smH'>TEAMS</td>

				<td class='tm'></td>

				<td class='gp'>GP</td>



				<td class='rec'>W-L-OTL</td>

				<td class='ptsBLD'>PTS</td>

			</tr>



			<?php $x = 0; foreach (index_team_stats('Atlantic') as $stat) { ?>

					<tr style='background: <?php if ($x%2) { ?>#FFFFFF<?php } else { ?>#E4E4E4<?php } ?>'>

						<td class='sm'><img src='images/logos/small/<?php echo strtolower($stat['teamabr']); ?>.png' class='small-logo' alt='' /></td>

						<td class='tm'> <a href='teams/index.php?tid=<?php echo $stat['teamid']; ?>&sid=2012'><?php echo $stat['team']; ?></a></td>

						<td class='gp'><?php echo $stat['gp']; ?></td>



						<td class='rec'><?php echo $stat['w']; ?>-<?php echo $stat['l']; ?>-<?php echo $stat['ol']; ?></td>

						<td class='ptsBLD'><?php echo $stat['p']; ?></td>

					</tr>

			<?php $x++; } ?>



		</table>

		<table class='standings'>

			<tr class='dheader'><td colspan='16'>NORTHEAST DIVISION</td></tr>

			<tr class='theader'>



				<td class='smH'>TEAMS</td>

				<td class='tm'></td>

				<td class='gp'>GP</td>

				<td class='rec'>W-L-OTL</td>

				<td class='ptsBLD'>PTS</td>

			</tr>

			<?php $x = 0; foreach (index_team_stats('Northeast') as $stat) { ?>

					<tr style='background: <?php if ($x%2) { ?>#FFFFFF<?php } else { ?>#E4E4E4<?php } ?>'>

						<td class='sm'><img src='images/logos/small/<?php echo strtolower($stat['teamabr']); ?>.png' class='small-logo' alt='' /></td>

						<td class='tm'> <a href='teams/?tid=18&amp;sid=2012'><?php echo $stat['team']; ?></a></td>

						<td class='gp'><?php echo $stat['gp']; ?></td>



						<td class='rec'><?php echo $stat['w']; ?>-<?php echo $stat['l']; ?>-<?php echo $stat['ol']; ?></td>

						<td class='ptsBLD'><?php echo $stat['p']; ?></td>

					</tr>

			<?php $x++; } ?>

		</table>

		<table class='standings-b'>

			<tr class='dheader'><td colspan='16'>SOUTHEAST DIVISION</td></tr>

			<tr class='theader'>

				<td class='smH'>TEAMS</td>

				<td class='tm'></td>

				<td class='gp'>GP</td>



				<td class='rec'>W-L-OTL</td>

				<td class='ptsBLD'>PTS</td>

			</tr>

			<?php $x = 0; foreach (index_team_stats('Southeast') as $stat) { ?>

					<tr style='background: <?php if ($x%2) { ?>#FFFFFF<?php } else { ?>#E4E4E4<?php } ?>'>

						<td class='sm'><img src='images/logos/small/<?php echo strtolower($stat['teamabr']); ?>.png' class='small-logo' alt='' /></td>

						<td class='tm'> <a href='teams/?tid=18&amp;sid=2012'><?php echo $stat['team']; ?></a></td>

						<td class='gp'><?php echo $stat['gp']; ?></td>



						<td class='rec'><?php echo $stat['w']; ?>-<?php echo $stat['l']; ?>-<?php echo $stat['ol']; ?></td>

						<td class='ptsBLD'><?php echo $stat['p']; ?></td>

					</tr>

			<?php $x++; } ?>

		</table>

	</div>



	<div id='standings-west'>

		<div id='standings-west-h'></div>



		<table class='standings'>

			<tr class='dheader'><td colspan='16'>CENTRAL DIVISION</td></tr>

			<tr class='theader'>

				<td class='smH'>TEAMS</td>

				<td class='tm'></td>

				<td class='gp'>GP</td>

				<td class='rec'>W-L-OTL</td>



				<td class='ptsBLD'>PTS</td>

			</tr>

			<?php $x = 0; foreach (index_team_stats('Central') as $stat) { ?>

					<tr style='background: <?php if ($x%2) { ?>#FFFFFF<?php } else { ?>#E4E4E4<?php } ?>'>

						<td class='sm'><img src='images/logos/small/<?php echo strtolower($stat['teamabr']); ?>.png' class='small-logo' alt='' /></td>

						<td class='tm'> <a href='teams/?tid=18&amp;sid=2012'><?php echo $stat['team']; ?></a></td>

						<td class='gp'><?php echo $stat['gp']; ?></td>



						<td class='rec'><?php echo $stat['w']; ?>-<?php echo $stat['l']; ?>-<?php echo $stat['ol']; ?></td>

						<td class='ptsBLD'><?php echo $stat['p']; ?></td>

					</tr>

			<?php $x++; } ?>

		</table>

		<table class='standings'>

			<tr class='dheader'><td colspan='16'>NORTHWEST DIVISION</td></tr>

			<tr class='theader'>

				<td class='smH'>TEAMS</td>



				<td class='tm'></td>

				<td class='gp'>GP</td>

				<td class='rec'>W-L-OTL</td>

				<td class='ptsBLD'>PTS</td>

			</tr>

			<?php $x = 0; foreach (index_team_stats('Northwest') as $stat) { ?>

					<tr style='background: <?php if ($x%2) { ?>#FFFFFF<?php } else { ?>#E4E4E4<?php } ?>'>

						<td class='sm'><img src='images/logos/small/<?php echo strtolower($stat['teamabr']); ?>.png' class='small-logo' alt='' /></td>

						<td class='tm'> <a href='teams/?tid=18&amp;sid=2012'><?php echo $stat['team']; ?></a></td>

						<td class='gp'><?php echo $stat['gp']; ?></td>



						<td class='rec'><?php echo $stat['w']; ?>-<?php echo $stat['l']; ?>-<?php echo $stat['ol']; ?></td>

						<td class='ptsBLD'><?php echo $stat['p']; ?></td>

					</tr>

			<?php $x++; } ?>

		</table>

		<table class='standings-b'>

			<tr class='dheader'><td colspan='16'>PACIFIC DIVISION</td></tr>

			<tr class='theader'>

				<td class='smH'>TEAMS</td>

				<td class='tm'></td>

				<td class='gp'>GP</td>



				<td class='rec'>W-L-OTL</td>

				<td class='ptsBLD'>PTS</td>

			</tr>

			<?php $x = 0; foreach (index_team_stats('Pacific') as $stat) { ?>

					<tr style='background: <?php if ($x%2) { ?>#FFFFFF<?php } else { ?>#E4E4E4<?php } ?>'>

						<td class='sm'><img src='images/logos/small/<?php echo strtolower($stat['teamabr']); ?>.png' class='small-logo' alt='' /></td>

						<td class='tm'> <a href='teams/?tid=18&amp;sid=2012'><?php echo $stat['team']; ?></a></td>

						<td class='gp'><?php echo $stat['gp']; ?></td>



						<td class='rec'><?php echo $stat['w']; ?>-<?php echo $stat['l']; ?>-<?php echo $stat['ol']; ?></td>

						<td class='ptsBLD'><?php echo $stat['p']; ?></td>

					</tr>

			<?php $x++; } ?>

		</table>

	</div>[/php]

Thanks for any help provided…

Well, not sure of your actual problem. First, why all the repeating code? Is this data pulled from a database? If so the data in the database should have the info you need. When you query the database to pull the data out, you just add your “ORDERED by” option to order the data by your info needed and use ASC for ascending. Then run thru your loop to print eh division and display the data by PHP. Not several different routines repeating the same code. Did that make sense or make it confusing?

So, where do you get the to be displayed? Is it from a database or from entries made manually.
And, what is your actual PHP question? Can you post a sample output or screenshot of your data indicating what you need changed? We are here to help, but, we need to know the question.

Sponsor our Newsletter | Privacy Policy | Terms of Service