1
1
mirror of https://github.com/neosubhamoy/neosubhamoy-portfolio.git synced 2025-12-20 03:29:35 +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

@@ -51,6 +51,8 @@ function fetch_social_icon($conn, $platform_name) {
}
}
//---functions to fetch search results starts here---
//from projects table
function fetch_search_results_projects($conn, $keyword) {
$sql = "SELECT * FROM projects WHERE name LIKE '%$keyword%'";
$result = $conn -> query($sql);
@@ -62,10 +64,11 @@ function fetch_search_results_projects($conn, $keyword) {
return $result;
}
else {
return array('results' => 'none', 'message' => ': (   No Results Found');
return array();
}
}
//from socials table
function fetch_search_results_socials($conn, $keyword) {
$sql = "SELECT * FROM socials WHERE platform LIKE '%$keyword%'";
$result = $conn -> query($sql);
@@ -77,7 +80,7 @@ function fetch_search_results_socials($conn, $keyword) {
return $result;
}
else {
return array('results' => 'none', 'message' => ': (   No Results Found');
return array();
}
}
?>