|
|
@ -14,6 +14,7 @@ if (isset($_POST['update'])) { |
|
|
|
$first_name = trim($_POST['first_name']); |
|
|
|
$first_name = trim($_POST['first_name']); |
|
|
|
$last_name = trim($_POST['last_name']); |
|
|
|
$last_name = trim($_POST['last_name']); |
|
|
|
$email = trim($_POST['email']); |
|
|
|
$email = trim($_POST['email']); |
|
|
|
|
|
|
|
$username = trim($_POST['username']); |
|
|
|
$phone = trim($_POST['phone']); |
|
|
|
$phone = trim($_POST['phone']); |
|
|
|
$skills = trim($_POST['skills']); |
|
|
|
$skills = trim($_POST['skills']); |
|
|
|
$experience = trim($_POST['experience']); |
|
|
|
$experience = trim($_POST['experience']); |
|
|
@ -25,13 +26,13 @@ if (isset($_POST['update'])) { |
|
|
|
|
|
|
|
|
|
|
|
// 1. First update the users table |
|
|
|
// 1. First update the users table |
|
|
|
$query_users = "UPDATE users |
|
|
|
$query_users = "UPDATE users |
|
|
|
SET firstname = ?, lastname = ?, email = ?, phone = ? |
|
|
|
SET firstname = ?, lastname = ?, email = ?, phone = ? ,username =? |
|
|
|
WHERE user_id = ?"; |
|
|
|
WHERE user_id = ?"; |
|
|
|
$stmt_users = $conn->prepare($query_users); |
|
|
|
$stmt_users = $conn->prepare($query_users); |
|
|
|
if (!$stmt_users) { |
|
|
|
if (!$stmt_users) { |
|
|
|
throw new Exception("Prepare failed for users table: " . $conn->error); |
|
|
|
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()) { |
|
|
|
if (!$stmt_users->execute()) { |
|
|
|
throw new Exception("Error updating users table: " . $stmt_users->error); |
|
|
|
throw new Exception("Error updating users table: " . $stmt_users->error); |
|
|
@ -81,8 +82,7 @@ if (isset($_POST['update'])) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$conn->commit(); |
|
|
|
$conn->commit(); |
|
|
|
$_SESSION['success_message'] = "Profile updated successfully!"; |
|
|
|
echo "<script>alert('Profile updated successfully! relogin to see the changes'); window.location.href = 'login';</script>"; |
|
|
|
header("Location: jobseekerprofile.php"); |
|
|
|
|
|
|
|
exit(); |
|
|
|
exit(); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception $e) { |
|
|
|
} catch (Exception $e) { |
|
|
|