1
1
mirror of https://github.com/neosubhamoy/neosubhamoy-portfolio.git synced 2025-12-20 02:19:34 +05:30

(refactor): implemented object,array based search result categories and multi table search on backend and frontend

This commit is contained in:
2023-11-18 15:39:39 +05:30
parent 81eecae9f0
commit a36c6ffd29
4 changed files with 35 additions and 47 deletions

View File

@@ -7,8 +7,20 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$keyword = $_POST['keyword'];
$results_projects = fetch_search_results_projects($conn, $keyword);
$results_socials = fetch_search_results_socials($conn, $keyword);
$results = array_merge($results_projects, $results_socials);
echo json_encode($results);
$results = [];
foreach ([$results_projects, $results_socials] as $array) {
if (!empty($array)) {
$results = array_merge($results, $array);
}
}
if(!empty($results)) {
echo json_encode($results);
}
else {
echo json_encode(array('results' => 'none', 'message' => ': (   No Results Found'));
}
}
}
?>