diff --git a/jobseekerprofile.php b/jobseekerprofile.php
index 496b3e3..b3b0d9f 100644
--- a/jobseekerprofile.php
+++ b/jobseekerprofile.php
@@ -15,7 +15,7 @@ $user_id = $_SESSION['user_id']; // Get user ID from the session
// Fetch user data from the database
-$query = "SELECT u.firstname, u.lastname, u.email, u.phone,
+$query = "SELECT u.firstname, u.lastname, u.email, u.phone,u.username,
j.skills, j.experience, j.education, j.location
FROM users u
LEFT JOIN job_seekers j ON u.user_id = j.user_id
@@ -101,13 +101,27 @@ if ($result->num_rows > 0) {
>
+
+
+
+ username
+
+
+
+
Phone Number
begin_transaction();
@@ -32,6 +32,7 @@ if (isset($_POST['update'])) {
}
$stmt_users->bind_param("sssssi", $first_name, $last_name, $email, $phone, $username,$user_id);
+
if (!$stmt_users->execute()) {
throw new Exception("Error updating users table: " . $stmt_users->error);
}
@@ -75,8 +76,8 @@ if (isset($_POST['update'])) {
}
$conn->commit();
- $_SESSION['success_message'] = "Profile updated successfully!";
- header("Location: employerprofile");
+ echo "";
+
exit();
} catch (Exception $e) {
diff --git a/updateprofile.php b/updateprofile.php
index 74a9d17..20ae8b4 100644
--- a/updateprofile.php
+++ b/updateprofile.php
@@ -14,6 +14,7 @@ if (isset($_POST['update'])) {
$first_name = trim($_POST['first_name']);
$last_name = trim($_POST['last_name']);
$email = trim($_POST['email']);
+ $username = trim($_POST['username']);
$phone = trim($_POST['phone']);
$skills = trim($_POST['skills']);
$experience = trim($_POST['experience']);
@@ -25,13 +26,13 @@ if (isset($_POST['update'])) {
// 1. First update the users table
$query_users = "UPDATE users
- SET firstname = ?, lastname = ?, email = ?, phone = ?
+ SET firstname = ?, lastname = ?, email = ?, phone = ? ,username =?
WHERE user_id = ?";
$stmt_users = $conn->prepare($query_users);
if (!$stmt_users) {
throw new Exception("Prepare failed for users table: " . $conn->error);
}
- $stmt_users->bind_param("ssssi", $first_name, $last_name, $email, $phone, $user_id);
+ $stmt_users->bind_param("sssssi", $first_name, $last_name, $email, $phone,$username, $user_id);
if (!$stmt_users->execute()) {
throw new Exception("Error updating users table: " . $stmt_users->error);
@@ -81,8 +82,7 @@ if (isset($_POST['update'])) {
}
$conn->commit();
- $_SESSION['success_message'] = "Profile updated successfully!";
- header("Location: jobseekerprofile.php");
+ echo "";
exit();
} catch (Exception $e) {