mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
Stuff i guess ?
This commit is contained in:
@@ -33,32 +33,27 @@ class SearchController extends Controller
|
||||
$results = [];
|
||||
|
||||
// Search movies (including adult videos)
|
||||
$movieStmt = $this->pdo->prepare("
|
||||
$searchTerm = $this->pdo->quote("%$search%");
|
||||
$movieStmt = $this->pdo->query("
|
||||
SELECT m.*, s.display_name as source_name, 'movie' as type
|
||||
FROM movies m
|
||||
JOIN sources s ON m.source_id = s.id
|
||||
WHERE (m.title LIKE :search OR m.overview LIKE :search)
|
||||
WHERE (m.title LIKE $searchTerm OR m.overview LIKE $searchTerm)
|
||||
ORDER BY m.title
|
||||
LIMIT 20
|
||||
");
|
||||
$searchParam = "%{$search}%";
|
||||
$movieStmt->bindParam(':search', $searchParam, \PDO::PARAM_STR);
|
||||
$movieStmt->execute();
|
||||
$results['movies'] = $movieStmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
// Search games
|
||||
$gameStmt = $this->pdo->prepare("
|
||||
SELECT g.*, s.display_name as source_name, 'game' as type
|
||||
$gameStmt = $this->pdo->query("
|
||||
SELECT g.*, 'game' as type
|
||||
FROM games g
|
||||
JOIN sources s ON g.source_id = s.id
|
||||
WHERE (g.name LIKE :search OR g.description LIKE :search)
|
||||
ORDER BY g.name
|
||||
WHERE (g.title LIKE $searchTerm OR g.description LIKE $searchTerm)
|
||||
ORDER BY g.title
|
||||
LIMIT 20
|
||||
");
|
||||
$gameStmt->bindParam(':search', $searchParam, \PDO::PARAM_STR);
|
||||
$gameStmt->execute();
|
||||
$results['games'] = $gameStmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
|
||||
return $this->view->render($response, 'search/index.twig', [
|
||||
'title' => 'Search Results',
|
||||
'search' => $search,
|
||||
|
||||
Reference in New Issue
Block a user