Getting data from 2 tables depending on user?!?!
Posted: Wed Nov 28, 2007 3:01 pm
I'm trying to make an leaderboard for my golfclub, and each member is signing up with alot of data wich is going in several different tables. I have now made a script where I get the avarage point from each player and then get a list/leaderboard with the players name and his avarage points like this:
Now I want to add some date (region) into the leaderboard for each player but the data comes from another table (oak_region). The "SpillerID" is unique for each player, and are offcourse in both tables... Can anyone help...
Code: Select all
echo '<table cellpadding="0" cellspacing="0">';
$result = mysql_query('SELECT AVG(oak_listen.Point) AS Sum, Navn FROM oak_listen GROUP BY SpillerID ORDER BY Sum DESC');
$i = 1;
while ($row = mysql_fetch_assoc($result)) {
echo '<tr>';
echo '<td width="5%" align="left" valign="middle">' . $i . '</td>';
echo '<td align="left" valign="middle">' . $row['Navn'] . '</td>';
echo '<td align="left" valign="middle">' . number_format($row['Sum'], 3) . '</td>';
echo '</tr>';
$i++;
}
echo '</table>';