Well not sure what Im doing wrong here, so here goes. Im trying to make a dynamic bid module for my league website. People will place bids on players so players can have multiple bids. I am trying to pull the team whos total bid(fbid) is the highest on a given player, and then loop it to the next player; but somewhere I screwed up lol. Any help would be greatly appreciated.
$query = "SELECT * FROM nuke_fa_bids";
$r = mysql_query($query) or die("Could not query: " . mysql_error());
while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) {
$player = $row['Player'];
if (!$result[$player] || $result[$player]['bid'] < $row['Fbid']) {
$result[$player]['bid'] = $row['Fbid'];
$result[$player]['team'] = $row['Team'];
$result[$player]['position'] = $row['Position'];
}
}
$count = 0;
echo '
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<th>Team</th>
<th>Player Name</th>
<th>Position</th>
<th>Winning Bid</th>
</tr>';
foreach ($result as $key => $value) {
if (($count % 2) == "0") {
$color = "D6CFCE";
} else {
$color = "0000FF";
}
echo '
<tr style="background-color:' . $color . ';">
<td align="left"><img src="images/smalllogos/'. $value[team] .'.gif"></td>
<td align="center" class="boldblacktext">' . $key . '</td>
<td align="center" class="boldblacktext">' . $value[position] . '</td>
<td align="center" class="boldblacktext">' . $value[bid] . '</td>
</tr>';
$count++;
}
echo '</table>';
If I echo $player it shows the players, If I echo $row['xxx'] it will show whatever I put, but however it will not echo $key, $value[xxx] or $result[$player]['xxx']. Again any help would be greatly appreciated. Also I should mention this was not how my original script worked(well didnt work lol) someone helped he tidy it up but now nothing at all shows except for the first table row with the column names. The person helped me touple shoot but everything seemed fine and it was working for him so I am hoping maybe to find some new ideas. Thanks again.