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

(refactor): using fetch_all_reacords() function + (feature): implemented dynamic currently working on section

This commit is contained in:
2023-11-01 14:27:58 +05:30
parent e9eee6b1b0
commit 5edcf4c562
4 changed files with 32 additions and 15 deletions

View File

@@ -1,4 +1,11 @@
<?php
//function to fetch all records of the given table
function fetch_all_records($conn, $table_name) {
$sql = "SELECT * FROM $table_name";
$result = $conn -> query($sql);
return $result;
}
//function to create an array of all unique project years
function create_project_years_array($conn) {
$sql = "SELECT DISTINCT year FROM projects ORDER BY year DESC";
@@ -20,11 +27,4 @@ function fetch_projects_by_year($conn, $year) {
$result = $conn -> query($sql);
return $result;
}
//function to fetch all featured projects
function fetch_featured_projects($conn) {
$sql = "SELECT * FROM featured_projects";
$result = $conn -> query($sql);
return $result;
}
?>