${result.description}
+ + + + ${'#' + result.tag} + + + `; + + searchRes.appendChild(profileDiv); + }); + } } function inject_no_results(results, keyword) { diff --git a/htdocs/core/handle_search.php b/htdocs/core/handle_search.php index 4e14d76..1ecba21 100644 --- a/htdocs/core/handle_search.php +++ b/htdocs/core/handle_search.php @@ -17,7 +17,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $results_projects = fetch_search_results_projects($conn, $keyword), $results_socials = fetch_search_results_socials($conn, $keyword), $results_pages = fetch_search_results_pages($conn, $keyword), - $results_quickactions = fetch_search_results_quickactions($conn, $keyword) + $results_quickactions = fetch_search_results_quickactions($conn, $keyword), + $results_profiles = fetch_search_results_profiles($conn, $keyword) ]; $results = []; diff --git a/htdocs/core/query_functions.php b/htdocs/core/query_functions.php index aa0ff90..4fba194 100644 --- a/htdocs/core/query_functions.php +++ b/htdocs/core/query_functions.php @@ -115,4 +115,20 @@ function fetch_search_results_quickactions($conn, $keyword) { return array(); } } + +//for quick_actions table +function fetch_search_results_profiles($conn, $keyword) { + $sql = "SELECT * FROM profile WHERE name LIKE '%$keyword%' OR stag LIKE '%$keyword%'"; + $result = $conn -> query($sql); + if($result -> num_rows > 0) { + $result = mysqli_fetch_all($result, MYSQLI_ASSOC); + foreach ($result as &$element) { + $element['tag'] = 'profile'; + } + return $result; + } + else { + return array(); + } +} ?> \ No newline at end of file