query("SELECT DISTINCT brand FROM vehicles WHERE brand IS NOT NULL AND brand != '' ORDER BY brand"); $brands = $stmtBrands->fetchAll(PDO::FETCH_COLUMN); // Fetch unique models $stmtModels = $pdo->query("SELECT DISTINCT model FROM vehicles WHERE model IS NOT NULL AND model != '' ORDER BY model"); $models = $stmtModels->fetchAll(PDO::FETCH_COLUMN); echo jsonResponse(true, 'Suggestions loaded', [ 'brands' => $brands, 'models' => $models ]); } catch (PDOException $e) { echo jsonResponse(false, 'Database error: ' . $e->getMessage()); }