"); exit(); } } getDatabaseLink($link); beginRO($link); function getItemBids($link, $itemId) { txcache_invaltag("bids", "item_id", $itemId); $bidsListResult = sql_query("SELECT * FROM bids WHERE item_id=$itemId ORDER BY date DESC", $link) or die("ERROR: Bids list query failed"); $bids = array(); while ($bidsListRow = sql_fetch_array($bidsListResult)) { $bids[] = $bidsListRow; } sql_free_result($bidsListResult); return $bids; } function viewbidhistory($link, $itemId) { // Get the item name $itemNameRow = getAnyItem($link, $itemId); if (!$itemNameRow) { die("

ERROR: Sorry, but this item does not exist.


\n"); } $itemName = $itemNameRow["name"]; // Get the list of bids for this item $bids = wrap(true, 'getItemBids', $link, $itemId); if (count($bids) == 0) print ("

There is no bid for $itemName.


"); else print ("

Bid history for $itemName


"); printHTMLheader("RUBiS: Bid history for $itemName."); print("\n". "\n". "\n"); foreach ($bids as $bidsListRow) { $bidAmount = $bidsListRow["bid"]; $bidDate = $bidsListRow["date"]; $userId = $bidsListRow["user_id"]; // Get the bidder nickname if ($userId != 0) { $userNameRow = getUser($link, $userId); $nickname = $userNameRow["nickname"]; } else { print("Cannot lookup the user!
"); printHTMLfooter($scriptName, $startTime); exit(); } print("
User IDBid amountDate of bid\n". "
$nickname" ."".$bidAmount."".$bidDate."\n"); } print("
\n"); sql_free_result($bidsListResult); } wrap(true, 'viewbidhistory', $link, $itemId); commit($link); sql_close($link); printHTMLfooter($scriptName, $startTime); ?>