1.6
This commit is contained in:
parent
2c6fd9a176
commit
b450e7e6df
BIN
assets/pasted-20251211-200142-74256b9a.png
Normal file
BIN
assets/pasted-20251211-200142-74256b9a.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
BIN
assets/pasted-20251211-200358-96530f55.png
Normal file
BIN
assets/pasted-20251211-200358-96530f55.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
14
debug_schema.php
Normal file
14
debug_schema.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->query("DESCRIBE items");
|
||||||
|
$columns = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($columns);
|
||||||
|
echo "</pre>";
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo "Error: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -8,7 +8,7 @@ if (isset($_GET['download_csv'])) {
|
|||||||
$user_id = $_SESSION['user_id'];
|
$user_id = $_SESSION['user_id'];
|
||||||
$pdo = db();
|
$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];
|
$query_params = [$user_id];
|
||||||
|
|
||||||
if (isset($_GET['search']) && !empty($_GET['search'])) {
|
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
|
$items = []; // Initialize an empty array to hold items
|
||||||
|
|
||||||
// Fetch items listed by the current vendor
|
// 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];
|
$total_items_params = [$user_id];
|
||||||
|
|
||||||
if (isset($_GET['search']) && !empty($_GET['search'])) {
|
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 = 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
|
$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
|
// 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];
|
$query_params = [$user_id];
|
||||||
|
|
||||||
if (isset($_GET['search']) && !empty($_GET['search'])) {
|
if (isset($_GET['search']) && !empty($_GET['search'])) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user