From 146c634870c30f958f3cb43de19cd43339cf48c8 Mon Sep 17 00:00:00 2001 From: Subhamoy Biswas Date: Thu, 2 Nov 2023 13:43:42 +0530 Subject: [PATCH] (feature): implemented dynamic socials rendering on home and projects page --- htdocs/core/query_functions.php | 23 +++++++++++++++++++++++ htdocs/index.php | 8 ++++---- htdocs/projects.php | 2 +- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/htdocs/core/query_functions.php b/htdocs/core/query_functions.php index b42fed3..c642008 100644 --- a/htdocs/core/query_functions.php +++ b/htdocs/core/query_functions.php @@ -27,4 +27,27 @@ function fetch_projects_by_year($conn, $year) { $result = $conn -> query($sql); return $result; } + +//function to fetch social link of the given platform +function fetch_social_link($conn, $platform_name) { + $sql = "SELECT link FROM socials WHERE platform = '$platform_name'"; + $result = $conn -> query($sql); + if($result -> num_rows > 0){ + $row = $result -> fetch_assoc(); + return $row['link']; + } + else { + return "#"; + } +} + +//function to fetch social icon of the given platform +function fetch_social_icon($conn, $platform_name) { + $sql = "SELECT icon FROM socials WHERE platform = '$platform_name'"; + $result = $conn -> query($sql); + if($result -> num_rows > 0){ + $row = $result -> fetch_assoc(); + return $row['icon']; + } +} ?> \ No newline at end of file diff --git a/htdocs/index.php b/htdocs/index.php index 25c11e0..1ae4bb2 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -24,10 +24,10 @@ require './core/query_functions.php';

Based on Kolkata, India

- - - - + + + +