JayC
Well-Known Member
I tried to use a join statement, but I had a rough time because trying to get the specific user and then all that, so I was just going to use 2 queries in a while loop.
This is what the page looks like:
So I can't seem to get it to display the rank.
Users Table -> Groupid, jobrank
Jobranks Table -> Jobid, rankid
PHP:
$q = mysql_query("SELECT * FROM users WHERE groupid = '" . $job['id'] . "' ORDER BY jobrank DESC") or die();
while($user = mysql_fetch_assoc($q))
{
echo "<table width='100%'>";
echo "<tr><td width='0%'>";
echo "<img src='" . FigGen() . $user['figure'] . "'>";
$query2 = mysql_query("SELECT groupid,jobrank FROM users WHERE username = '".$user['username']."'");
$query3 = mysql_query("SELECT name FROM jobranks WHERE jobrank = '".$query2['groupid']."' AND rankid = '".$query2['jobrank']."'");
echo "
</td>
<td>
<b>Name:</b> " . $user['username'] . " <br/>
<b>Rank:</b> " . $query3['name'] . " <br/>
<b>Last visit:</b> " . date("F j, Y, g:i a",$user['timestamp_lastvisit']) . "
</td>
</tr>";
echo "</table><hr>";
}
So I can't seem to get it to display the rank.
Users Table -> Groupid, jobrank
Jobranks Table -> Jobid, rankid