I am currently coding a multiplayer game in php and I am lost on one part.
On the rankings page, I have the table display the following:
Rank - Username - Alliance - etc.
01 - Copephobia - 1 - etc.
02 - Bob - 2 - etc.
What I want to do is write the alliance tag for each alliance the member is in.
Here's how it goes:
-Sort player id's based on rank
-Display player information
Here's what I want to do next:
-print alliance tag based on alliance id
how exactly what I do that?
I'm not sure exactly what you are asking for. The code below is what my interpretation of what you wanted is. If this isn't what you want it would be beneficial if you elaborate on what you want.
Edit: Re read your post. Code has been updated.Code:$rankingQuery = "Select * from users ORDER BY rank Asc, username";
$runRankingQuery = mysql_query($rankingQuery)or die(mysql_error());
while($getRank = mysql_fetch_array($runRankingQuery))
{
echo "User:";
echo $getRank['username'];
echo "<br />Rank:";
echo $getRank['rank'];
echo "<br />Aliance:";
$alianceQuery="Select alianceName from aliance where alianceId = $getRank[aliance]";
$runAlianceQuery=mysql_query($alianceQuery)or die(mysql_error());
$getAliance=mysql_fetch_array($runAlianceQuery);
echo $getAliance['alianceName'];
echo "<br /><br />";
}
It could also be useful to use a join to get the alliance name as part of the original query.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks