From 5d26b0fadaa24e21d6729c9883ba47bb6770f45b Mon Sep 17 00:00:00 2001 From: Joshua Perry <45966243+jpez-development@users.noreply.github.com> Date: Sun, 20 Nov 2022 14:44:18 +0000 Subject: [PATCH] added editAuction functionallity --- functions.php | 25 +++++++++++++++++++++++++ public/account/addAuction.php | 12 +++--------- public/account/editAuction.php | 32 ++++++++++++++++++++++++++++++++ public/listing.php | 14 +++----------- 4 files changed, 63 insertions(+), 20 deletions(-) diff --git a/functions.php b/functions.php index 8fddea8..3d08eb1 100644 --- a/functions.php +++ b/functions.php @@ -27,4 +27,29 @@ function startDB() { $pdo = new PDO('mysql:dbname=' . $schema . ';host=' . $server, $username, $password); return $pdo; } + +function checkListing() { + if (!isset($_GET['listing_id'])) { + echo ''; + } +} + +function getListing() { + $pdo = startDB(); + $stmt = $pdo->prepare('SELECT * FROM auction WHERE listing_id = :listing_id'); + $values = [ + 'listing_id' => $_GET['listing_id'] + ]; + $stmt->execute($values); + return $stmt->fetch(); +} + +function populateCatSelect() { + $cats = fetchCats(); + $output = ''; + foreach ($cats as &$cat) { + $output .= ''; + } + return $output; +} ?> \ No newline at end of file diff --git a/public/account/addAuction.php b/public/account/addAuction.php index cf90513..f3617c8 100644 --- a/public/account/addAuction.php +++ b/public/account/addAuction.php @@ -13,7 +13,7 @@ $pdo = startDB(); $pageContent = '
Auction created by '. $user['first_name'].$user['last_name'] .'
Current bid: '. $bid['MAX(amount)'] .'
- +