From 6bc83c8211688fded0881dd8dffd30f022a39767 Mon Sep 17 00:00:00 2001 From: Joshua Perry <45966243+jpez-development@users.noreply.github.com> Date: Tue, 15 Nov 2022 15:43:46 +0000 Subject: [PATCH] adjusted query --- public/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/index.php b/public/index.php index 4383b37..6bdd75b 100644 --- a/public/index.php +++ b/public/index.php @@ -29,7 +29,7 @@ function populateList($category) { //TODO: This will need to be updated to popul $listings = $stmt->fetchAll(); } else { - $stmt = $pdo->prepare('SELECT * FROM listings WHERE listing_category = :listing_category'); + $stmt = $pdo->prepare('SELECT * FROM listings WHERE listing_category = (SELECT category_id FROM categories WHERE category_name = :listing_category)'); $values = [ 'listing_category' => $category ]; @@ -50,7 +50,7 @@ function populateList($category) { //TODO: This will need to be updated to popul

'. $listing['listing_name'] .'

'. $listing['listing_category'] .'

'. $listing['listing_description'] .'

-

Current bid:'. $stmt->fetch() .'

+

Current bid:'. $stmt->fetch()['MAX(amount)'] .'

More >> ';