prepare("UPDATE cars SET status = ? WHERE id = ?"); if ($stmt->execute([$status, $car_id])) { $message = "Car listing " . ($status === 'approved' ? 'approved' : 'rejected') . " successfully."; } } if (isset($_GET['delete'])) { $id = $_GET['delete']; $stmt = $pdo->prepare("UPDATE cars SET deleted_at = NOW() WHERE id = ?"); if ($stmt->execute([$id])) { $message = "Car deleted successfully."; } } // Fetch all cars with user and image info $stmt = $pdo->query(" SELECT c.*, u.name as seller_name, u.phone as seller_phone, ci.image_path FROM cars c JOIN users u ON c.user_id = u.id LEFT JOIN car_images ci ON c.id = ci.car_id AND ci.is_main = 1 WHERE c.deleted_at IS NULL ORDER BY c.created_at DESC "); $cars = $stmt->fetchAll(); ?>
Review and approve vehicle listings from sellers.
| Vehicle | Seller | Price | Location | Status | Action |
|---|---|---|---|---|---|
= htmlspecialchars($car['brand'] . ' ' . $car['model']) ?>
= $car['year'] ?>
|
= htmlspecialchars($car['seller_name']) ?>
= htmlspecialchars($car['seller_phone']) ?>
|
$= number_format($car['price']) ?> | = htmlspecialchars($car['city']) ?> | = $car['status'] ?> |