post auction

'.$pageHeading.'

'; require '../layout.php'; function populateList($category) { $pdo = startDB(); $output = ''; if ($category === 'Latest Listings') { $stmt = $pdo->prepare('SELECT * FROM auction WHERE endDate > "'. date("Y-m-d H:i:s"). '" ORDER BY endDate ASC'); $stmt->execute(); $listings = $stmt->fetchAll(); $count = 10; } else { $stmt = $pdo->prepare('SELECT * FROM auction WHERE categoryId = (SELECT category_id FROM category WHERE name = :listing_category)'); $values = [ 'listing_category' => $category ]; $stmt->execute($values); $listings = $stmt->fetchAll(); } foreach ($listings as &$listing) { $listCat = getFirstAllMatches('category', 'category_id', $listing['categoryId'])['name']; $bid = getFirstMatch('bids','MAX(amount)', 'listing_id', $listing['listing_id']); $output .= '
  • product name

    '. $listing['title'] .'

    '. $listing['categoryId'] .'

    '. $listing['description'] .'

    Current bid:'. $bid['MAX(amount)'] .'

    More >>
  • '; if ($category === 'Latest Listings') { $count -= 1; if ($count <= 0) { break; } } } return $output; } ?>