diff --git a/assets/pasted-20251211-200142-74256b9a.png b/assets/pasted-20251211-200142-74256b9a.png new file mode 100644 index 0000000..f820ae9 Binary files /dev/null and b/assets/pasted-20251211-200142-74256b9a.png differ diff --git a/assets/pasted-20251211-200358-96530f55.png b/assets/pasted-20251211-200358-96530f55.png new file mode 100644 index 0000000..67b78e3 Binary files /dev/null and b/assets/pasted-20251211-200358-96530f55.png differ diff --git a/debug_schema.php b/debug_schema.php new file mode 100644 index 0000000..dc152ef --- /dev/null +++ b/debug_schema.php @@ -0,0 +1,14 @@ +query("DESCRIBE items"); + $columns = $stmt->fetchAll(PDO::FETCH_ASSOC); + echo "
"; + print_r($columns); + echo ""; +} catch (Exception $e) { + echo "Error: " . $e->getMessage(); +} +?> \ No newline at end of file diff --git a/my_listings.php b/my_listings.php index 9ed622c..24cc9d1 100644 --- a/my_listings.php +++ b/my_listings.php @@ -8,7 +8,7 @@ if (isset($_GET['download_csv'])) { $user_id = $_SESSION['user_id']; $pdo = db(); - $query = "SELECT name, description, price, location, status, creation_date FROM items WHERE owner_id = ?"; + $query = "SELECT name, description, price, location, status, creation_date FROM items WHERE vendor_id = ?"; $query_params = [$user_id]; if (isset($_GET['search']) && !empty($_GET['search'])) { @@ -92,7 +92,7 @@ $pdo = db(); // Get the PDO connection $items = []; // Initialize an empty array to hold items // Fetch items listed by the current vendor - $total_items_query = "SELECT COUNT(*) FROM items WHERE owner_id = ?"; + $total_items_query = "SELECT COUNT(*) FROM items WHERE vendor_id = ?"; $total_items_params = [$user_id]; if (isset($_GET['search']) && !empty($_GET['search'])) { @@ -116,10 +116,10 @@ $items = []; // Initialize an empty array to hold items $current_page = isset($_GET['page']) ? (int)$_GET['page'] : 1; $current_page = max(1, min($current_page, $total_pages == 0 ? 1 : $total_pages)); // Ensure current page is within valid range - $offset = ($current_page - 1) * ITEMS_PER_PAGE; + $offset = ($current_page - 1) * $items_per_page; // Fetch items listed by the current vendor - $query = "SELECT * FROM items WHERE owner_id = ?"; + $query = "SELECT * FROM items WHERE vendor_id = ?"; $query_params = [$user_id]; if (isset($_GET['search']) && !empty($_GET['search'])) {