private static function queryResultToAdvancedAuctions($result)
 {
     $liveAuctions = [];
     while ($row = $result->fetch_assoc()) {
         $auction = new Auction($row);
         $auctionId = $auction->getAuctionId();
         $bids = self::getAuctionBids($auctionId);
         $views = $auction->getViews();
         $watches = self::getAuctionWatches($auctionId);
         $liveAuction = new AdvancedAuction($auction, $bids, $views, $watches);
         $liveAuctions[] = $liveAuction;
     }
     return $liveAuctions;
 }
Ejemplo n.º 2
0
         $auction->setUserId($row['user_id']);
         $auction->setCreationTime($row['auction_creation_time']);
         $auction->setEndTime($row['auction_end_time']);
         $auction->setAuctionEnded($row['auction_ended']);
         $auction->setWinnerUserName($row['winner_username']);
     }
 }
 $user_id = $auction->getUserId();
 $user_query = mysqli_query($link, "SELECT * FROM users WHERE id={$user_id}");
 if ($user_query !== null) {
     while ($row = mysqli_fetch_array($user_query)) {
         $auction->setSellerUserName($row['username']);
         $auction->setSellerDisplayName($row['displayname']);
     }
 }
 $bid_query = mysqli_query($link, "SELECT * FROM bids WHERE auction_id={$auction->getAuctionId()}");
 $highest_bid = 0.0;
 if ($bid_query !== null) {
     while ($row = mysqli_fetch_array($bid_query)) {
         if ($highest_bid < $row['bid_amount']) {
             $highest_bid = $row['bid_amount'];
         }
     }
 }
 $textbook = null;
 //Check to see if ISBN 10/13 is set for the textbook being offered for sale (Should either always return a result or have no result)
 if (!empty($auction->getISBN()) && $auction->getISBN() !== null) {
     $textbook_query = null;
     if (strlen($auction->getISBN()) === 10) {
         $textbook_query = mysqli_query($link, "SELECT * FROM textbooks WHERE ISBN_v10='ISBN-10:{$auction->getISBN()}'");
     } else {