Jump to content

[SOLVED] Organizing results


uramagget

Recommended Posts

$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. :/

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
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.