Pythondesigns Posted October 26, 2006 Share Posted October 26, 2006 Ok,Im coding a league system... Each league can have multiple divisions.Here are three tables...leagues(id, name);divisions(id, leagueID);scores(id, leagueID, userID, score);For this example lets assume that there is one league, three divisions within that league and 20 rows in the scores table.I want to loop through and display a table for each division.I want to order the scores table by the score field ASC. Then display them in the divisions (10 per divisions).So in division one it has the top 10 scores.In division two the 11-20 top scoresIn division three 21-30 top scores.Can you help me.Thanks Link to comment https://forums.phpfreaks.com/topic/25209-leage-table-help-probably-simple/ Share on other sites More sharing options...
Pythondesigns Posted October 27, 2006 Author Share Posted October 27, 2006 anyone? Link to comment https://forums.phpfreaks.com/topic/25209-leage-table-help-probably-simple/#findComment-115314 Share on other sites More sharing options...
ToonMariner Posted October 27, 2006 Share Posted October 27, 2006 you may find the foreach or while construtcs useful along with array_multisort....anything more and I'd just be doing it for you! Link to comment https://forums.phpfreaks.com/topic/25209-leage-table-help-probably-simple/#findComment-115315 Share on other sites More sharing options...
Pythondesigns Posted October 27, 2006 Author Share Posted October 27, 2006 Im still confused. Perhaps an example? Link to comment https://forums.phpfreaks.com/topic/25209-leage-table-help-probably-simple/#findComment-115600 Share on other sites More sharing options...
Caesar Posted October 27, 2006 Share Posted October 27, 2006 [quote author=ToonMariner link=topic=112830.msg458514#msg458514 date=1161949120]anything more and I'd just be doing it for you![/quote] ;) Link to comment https://forums.phpfreaks.com/topic/25209-leage-table-help-probably-simple/#findComment-115602 Share on other sites More sharing options...
Pythondesigns Posted October 27, 2006 Author Share Posted October 27, 2006 Geez,I thought this was a PHP [b]Help[/b] forum. Guess I was wrong :o Link to comment https://forums.phpfreaks.com/topic/25209-leage-table-help-probably-simple/#findComment-115627 Share on other sites More sharing options...
Pythondesigns Posted November 6, 2006 Author Share Posted November 6, 2006 Im still looking for help on this...? Link to comment https://forums.phpfreaks.com/topic/25209-leage-table-help-probably-simple/#findComment-120434 Share on other sites More sharing options...
Orio Posted November 6, 2006 Share Posted November 6, 2006 Something like this??[code]<?php$query1 = "SELECT id FROM `leagues`";$result1 = mysql_query($query1);while($league = mysql_fetch_array($result1)){ $query2 = "SELECT COUNT(*) AS num FROM `divisions`"; $result2 = mysql_query($query2); $division = mysql_fetch_array($result2); $tables = $division['num']; $i = 0; while($i < $tables) { $query3 = "SELECT * FROM `scores` ORDER BY score LIMIT ".$i.","($i+10); $result3 = mysql_query($query3); echo "<table><tr><td>id</td><td>score</td></tr>\n"; while($row = mysql_fetch_array($result3)) { echo "<tr>"; echo "<td>".$row['id']."</td>"; echo "<td>".$row['score']."</td>"; echo "</tr>"; } echo "</table><br><br>"; $i = $i + 10; }}?>[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/25209-leage-table-help-probably-simple/#findComment-120502 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.