diff --git a/employerprofile.php b/employerprofile.php index 41462a1..cb5bb71 100644 --- a/employerprofile.php +++ b/employerprofile.php @@ -13,9 +13,8 @@ if (!isset($_SESSION['user_id'])) { $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, - e.company_name, e.company_email, e.company_address, - e.industry +$query = "SELECT u.firstname, u.lastname,u.username, u.email, u.phone, + e.address FROM users u LEFT JOIN employers e ON u.user_id = e.user_id WHERE u.user_id = ?"; @@ -96,6 +95,19 @@ if ($result->num_rows > 0) { required > + +
+ + +
@@ -114,12 +126,12 @@ if ($result->num_rows > 0) {
diff --git a/updateemployeeprofile.php b/updateemployeeprofile.php index 5c0052d..69b1544 100644 --- a/updateemployeeprofile.php +++ b/updateemployeeprofile.php @@ -15,7 +15,8 @@ if (isset($_POST['update'])) { $last_name = trim($_POST['last_name']); $email = trim($_POST['email']); $phone = trim($_POST['phone']); - $company_address = trim($_POST['company_address']); + $username = trim($_POST['username']); + $address = trim($_POST['address']); try { @@ -23,13 +24,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); @@ -48,29 +49,29 @@ if (isset($_POST['update'])) { // Update existing record $employer_query = "UPDATE employers SET - company_address = ? + address = ? WHERE user_id = ?"; } else { // Insert new record $employer_query = "INSERT INTO employers - ( company_address, user_id) + ( address, user_id) VALUES (?, ?)"; } $stmt_employers = $conn->prepare($employer_query); if (!$stmt_employers) { - throw new Exception("Prepare failed for job_seekers table: " . $conn->error); + throw new Exception("Prepare failed for Employer table: " . $conn->error); } // Same binding for both UPDATE and INSERT $stmt_employers->bind_param("si", - $company_address, + $address, $user_id ); if (!$stmt_employers->execute()) { - throw new Exception("Error with job_seekers table: " . $stmt_employers->error); + throw new Exception("Error with E ployers table: " . $stmt_employers->error); } $conn->commit();