From 82a924238af9a0f9c798785e95f18417d795d2cf Mon Sep 17 00:00:00 2001 From: mbabidblessing Date: Wed, 28 Aug 2024 16:33:07 +0100 Subject: [PATCH 1/3] added a button funtion for adding skills --- public/{skills => }/add.php | 6 ++-- public/process.php | 10 +++---- public/skills.php | 60 +++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 8 deletions(-) rename public/{skills => }/add.php (93%) mode change 100755 => 100644 create mode 100644 public/skills.php diff --git a/public/skills/add.php b/public/add.php old mode 100755 new mode 100644 similarity index 93% rename from public/skills/add.php rename to public/add.php index 743d513..648017f --- a/public/skills/add.php +++ b/public/add.php @@ -11,8 +11,8 @@

Add Skills




-

Proficiency

- @@ -40,7 +40,7 @@ ?> - + diff --git a/public/process.php b/public/process.php index 9b73108..df45249 100755 --- a/public/process.php +++ b/public/process.php @@ -2,7 +2,7 @@ session_start(); if ($_SERVER["REQUEST_METHOD"] === "POST") { $Skill = $_POST['Skill']; - $Proficiency = $_POST['Proficiency']; + $proficiencyLevel = $_POST['proficiencyLevel']; $Experience = $_POST['Experience']; $Description = $_POST['Description']; //adding into the database @@ -22,8 +22,8 @@ echo " Database connected"; } ; try { - $sql= "INSERT INTO skills (Skill, Proficiency, Experience, Description) - VALUES ('$Skill','$Proficiency','$Experience','$Description')"; + $sql= "INSERT INTO skills (Skill, proficiencyLevel, Experience, Description) + VALUES ('$Skill','$proficiencyLevel','$Experience','$Description')"; if(mysqli_query($conn, $sql)){ echo "
New record created successfully"; } @@ -39,14 +39,14 @@ } $Store = [ 'Skill' => $Skill, - 'Proficiency' => $Proficiency, + 'proficiencyLevel' => $proficiencyLevel, 'Experience' => $Experience, 'Description' => $Description ]; $_SESSION['Skill'] = $Store; $Skill = $_SESSION['Skill']; - // echo $Store['Skill'],'
', $Store['Proficiency'],'
',$Store['Experience'],'
',$Store['Description'],'
'; + // echo $Store['Skill'],'
', $Store['ProficciencyLevel'],'
',$Store['Experience'],'
',$Store['Description'],'
'; // displaying the information when only one session is stored foreach ($Store as $value){ diff --git a/public/skills.php b/public/skills.php new file mode 100644 index 0000000..692f86e --- /dev/null +++ b/public/skills.php @@ -0,0 +1,60 @@ + + + + + + Document + +

Fetched skills

+ +
+

Skills

+ +
+
+
+ Skill 1 +
+
+ +
+
+ Skill 2
+
+ +
+
+ Skill 3 +
+
+ + +
+ + + +
+ +
+
+ connect_error) { + echo "Failed to connect to MySQL: " . $conn -> connect_error; + exit(); +} + +// Perform query +if ($result = $conn -> query("SELECT * FROM Skills")) { + echo "Returned rows are: " . $result -> num_rows; + // Free result set + $result = $conn -> store_result(); + +} +$conn -> close(); + +?> + + + \ No newline at end of file From 1f38e9123ea792fb9f05bdc48fd05fa7eae02825 Mon Sep 17 00:00:00 2001 From: mbabidblessing Date: Thu, 29 Aug 2024 05:38:46 +0100 Subject: [PATCH 2/3] fetched skills from database --- public/skills.php | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/public/skills.php b/public/skills.php index 692f86e..f308093 100644 --- a/public/skills.php +++ b/public/skills.php @@ -39,21 +39,28 @@ connect_error) { - echo "Failed to connect to MySQL: " . $conn -> connect_error; - exit(); -} +//$user_id =$_SESSION['user_id']; -// Perform query -if ($result = $conn -> query("SELECT * FROM Skills")) { - echo "Returned rows are: " . $result -> num_rows; - // Free result set - $result = $conn -> store_result(); - + if($conn -> connect_error){ + die ('connection failed:' . $conn->connect_error); + } +//fetching data fron the database +$query = "SELECT * FROM skills where user_id = 1"; +$result =mysqli_query($conn, $query); +if(mysqli_num_rows($result)>0){ + while($row = mysqli_fetch_assoc($result)){ + echo $row['name']; + echo $row['proficiencyLevel']; + echo $row['description']; + + } +}else{ +echo "No data skill found on the skill table"; } -$conn -> close(); - +$conn->close(); + // } ?> From 47156db1f2022a989d85d51af8099ff500055313 Mon Sep 17 00:00:00 2001 From: mbabidblessing Date: Thu, 29 Aug 2024 06:17:17 +0100 Subject: [PATCH 3/3] Fetched skills from database --- public/skills.php | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/public/skills.php b/public/skills.php index f308093..a34d912 100644 --- a/public/skills.php +++ b/public/skills.php @@ -1,42 +1,4 @@ - - - - - - Document - -

Fetched skills

- -
-

Skills

-
-
-
- Skill 1 -
-
- -
-
- Skill 2
-
- -
-
- Skill 3 -
-
- - -
- - - -
- -
-