1
1
mirror of https://github.com/neosubhamoy/neosubhamoy-portfolio.git synced 2025-12-20 03:29:35 +05:30

(feat): added tag for search results

This commit is contained in:
2023-11-17 20:04:34 +05:30
parent b7e41b3003
commit 9bd71fd132

View File

@@ -55,7 +55,11 @@ function fetch_search_results($conn, $keyword) {
$sql = "SELECT * FROM projects WHERE name LIKE '%$keyword%'"; $sql = "SELECT * FROM projects WHERE name LIKE '%$keyword%'";
$result = $conn -> query($sql); $result = $conn -> query($sql);
if($result -> num_rows > 0) { if($result -> num_rows > 0) {
return mysqli_fetch_all($result, MYSQLI_ASSOC); $result = mysqli_fetch_all($result, MYSQLI_ASSOC);
foreach ($result as &$element) {
$element['tag'] = 'project';
}
return $result;
} }
else { else {
return array('results' => 'none'); return array('results' => 'none');