uramagget Posted July 20, 2008 Share Posted July 20, 2008 $players = $mysql->select( "ndsg_brawl.tourneys_brackets", "*", "WHERE tourney = '{$title}'" ); if ($players) { while ($pairings = @mysql_fetch_assoc($players)) { echo ' <h2>Round '.$pairings['round'].'</h2> <table class="list"> <thead> <tr> <td>User #1</td> <td>User #2</td> <td>Round</td> </tr> </thead><tbody>'; $username1 = $mysql->select( "ndsg_vbulletin.vb_user", "username", "WHERE userid = '{$pairings['userid']}'" ); $username2 = $mysql->select( "ndsg_vbulletin.vb_user", "username", "WHERE userid = '{$pairings['userid2']}'" ); $username1 = @mysql_fetch_assoc($username1); $username2 = @mysql_fetch_assoc($username2); echo '<tr> <td>'.$username1['username'].'</td> <td>'.$username2['username'].'</td> <td>'.$pairings['round'].'</td> </tr>'; echo '</tbody></table>'; } } else { echo '<p>There are no standings up yet.</p>'; } I am not sure how to have it only display 1 table for each round. I tried using GROUP BY `round`, but it only displays 1 pairing instead of all. :/ Quote Link to comment Share on other sites More sharing options...
uramagget Posted July 21, 2008 Author Share Posted July 21, 2008 Bump, I think? I wish I can edit my post to fix out issues I have left within it, though. For some reason I cannot edit it. Quote Link to comment Share on other sites More sharing options...
bluejay002 Posted July 21, 2008 Share Posted July 21, 2008 can you post the actual query sent rather than the code? Quote Link to comment Share on other sites More sharing options...
uramagget Posted July 21, 2008 Author Share Posted July 21, 2008 Yes; I have been meaning to fix that. Apologies: SELECT * FROM ndsg_brawl.tourneys_brackets WHERE tourney = 'brawlan' Quote Link to comment Share on other sites More sharing options...
bluejay002 Posted July 21, 2008 Share Posted July 21, 2008 can you give an info bout the structure of the database? or the tables that are being used? and what you are trying to achieve? thanks Quote Link to comment Share on other sites More sharing options...
uramagget Posted July 21, 2008 Author Share Posted July 21, 2008 Of course: Database: ndsg_brawl Table: tourneys_brackets -> userid -> userid2 -> round -> winner I believe that it all though, unless, you need me to post the query for the user IDs (to grab usernames from the forum database). Anything else you need? Quote Link to comment Share on other sites More sharing options...
bluejay002 Posted July 22, 2008 Share Posted July 22, 2008 am not sure if am gettin what you are trying to achieve but you can try this: SELECT GROUP_CONCAT(userid) userid1, GROUP_CONCAT(userid2) userid2 FROM ndsg_brawl.tourneys_brackets WHERE tourney = 'brawlan' GROUP BY round with this, each userid is delimited with comma by default otherwise specified. now this works... but the problem is that it might be slower and pairing... so you might also try, SELECT GROUP_CONCAT(userid, userid2) userids FROM ndsg_brawl.tourneys_brackets WHERE tourney = 'brawlan' GROUP BY round with this, userid and userid2 is delimited with space by default where each pairing is delimited with comma. now, if you want to change the delimiter for userid and userid2, you may try CONCAT() for additional mods. did I answer you question? 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.