+
+
+ Job Type
+
+
+ Select Type
+ >Childcare and Petcare
+ >Cleaning and Maintenance
+ >Delivery and Logistics
+ >Seasonal
+
+
-
-
- skills level
-
-
- Select Level
- Entry Level
- Intermediate
- Experienced
-
-
+
+
+ Salary Type
+
+
+ Select Range
+ >Hourly
+ >Daily
+
-
-
Reset
-
Apply Filters
+
+
+ Skills Level
+
+
+ Select Level
+ >Entry Level
+ >Intermediate
+ >Experienced
+
-
-
-
+
+
+
+ Reset
+ Apply Filters
+
+
+
+
+
+
+
How It Works
diff --git a/managejob.php b/managejob.php
index d9ab1db..ab90770 100644
--- a/managejob.php
+++ b/managejob.php
@@ -162,9 +162,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['job_title'])) {
Select Type
- childcare and petcare
- cleaning and maintainence
- delivery and logistics
+ Childcare and Petcare
+ Cleaning and Maintenance
+ Delivery and Logistics
Seasonal
diff --git a/search_results.php b/search_results.php
index 0def023..f574afd 100644
--- a/search_results.php
+++ b/search_results.php
@@ -4,65 +4,68 @@ include 'connect.php';
// Check if the user is logged in
if (!isset($_SESSION['email'])) {
- // If not logged in, redirect to login page
header("Location: login.php");
exit();
}
-// Build the SQL query based on search parameters
-$where_conditions = array();
-$params = array();
-$types = "";
-
-// Search by job title or description
-if (!empty($_GET['search'])) {
- $where_conditions[] = "(job_title LIKE ? OR description LIKE ?)";
- $search_term = "%" . $_GET['search'] . "%";
- $params[] = $search_term;
- $params[] = $search_term;
- $types .= "ss";
-}
-
-// Search by location
-if (!empty($_GET['location'])) {
- $where_conditions[] = "location = ?";
- $params[] = $_GET['location'];
- $types .= "s";
-}
-
-// Search by job type
-if (!empty($_GET['job_type'])) {
- $where_conditions[] = "job_type = ?";
- $params[] = $_GET['job_type'];
- $types .= "s";
-}
-
-// Search by salary type
-if (!empty($_GET['salary_type'])) {
- $where_conditions[] = "salary LIKE ?";
- $params[] = "%" . $_GET['salary_type'] . "%";
- $types .= "s";
-}
+try {
+ // Initialize arrays for query building
+ $where_conditions = [];
+ $params = [];
+ $types = "";
+
+ // Search by job title or description
+ if (!empty($_GET['search'])) {
+ $where_conditions[] = "(job_title LIKE ? OR job_description LIKE ?)";
+ $search_term = "%" . $_GET['search'] . "%";
+ $params[] = $search_term;
+ $params[] = $search_term;
+ $types .= "ss";
+ }
+
+ // Job type filter
+ if (!empty($_GET['job_type'])) {
+ $where_conditions[] = "job_type = ?";
+ $params[] = $_GET['job_type'];
+ $types .= "s";
+ }
+
+ // Salary type filter
+ if (!empty($_GET['salary_type'])) {
+ $where_conditions[] = "salary_type = ?"; // Changed to match the exact column name
+ $params[] = $_GET['salary_type'];
+ $types .= "s";
+ }
+
+ // Skills level filter
+ if (!empty($_GET['skills_level'])) {
+ $where_conditions[] = "skills_level = ?";
+ $params[] = $_GET['skills_level'];
+ $types .= "s";
+ }
+
+ // Construct the SQL query
+ $sql = "SELECT * FROM job_postings";
+
+ // Add WHERE clause if there are conditions
+ if (!empty($where_conditions)) {
+ $sql .= " WHERE " . implode(" AND ", $where_conditions);
+ }
+
+ // Add ordering
+ $sql .= " ORDER BY posted_date DESC";
+
+ // Prepare and execute the query
+ $stmt = $conn->prepare($sql);
+
+ if (!empty($params)) {
+ $stmt->bind_param($types, ...$params);
+ }
+
+ $stmt->execute();
+ $result = $stmt->get_result();
-// Search by skill level
-if (!empty($_GET['skill_level'])) {
- $where_conditions[] = "skill_level = ?";
- $params[] = $_GET['skill_level'];
- $types .= "s";
-}
-
-$sql = "SELECT * FROM job_postings";
-if (!empty($where_conditions)) {
- $sql .= " WHERE " . implode(" AND ", $where_conditions);
-}
-$sql .= " ORDER BY posted_date DESC";
-
-$stmt = $conn->prepare($sql);
-if (!empty($params)) {
- $stmt->bind_param($types, ...$params);
-}
?>
-
@@ -85,18 +88,16 @@ if (!empty($params)) {
execute();
- $result = $stmt->get_result();
-
- if ($result->num_rows > 0) {
+ if ($result && $result->num_rows > 0) {
while ($job = $result->fetch_assoc()) {
?>
= htmlspecialchars($job['job_title']) ?>
-
+
+
@@ -107,47 +108,78 @@ if (!empty($params)) {
+
-
Salary
+
Salary (= htmlspecialchars($job['salary_type']) ?>)
= htmlspecialchars($job['salary']) ?>
+
-
-
+
+
-
Posted Date
-
= date('F j, Y', strtotime($job['posted_date'])) ?>
+
Job Type
+
= htmlspecialchars($job['job_type']) ?>
-
-
+
+
+
+
+
+
+
Required Skills
+
= htmlspecialchars($job['skills_level']) ?>
+
+
+
+
-
- View Details
-
+
+ View Details
+
+
No jobs available.";
+ echo "";
+ echo "
No Jobs Found ";
+ echo "
Try adjusting your search criteria or removing some filters.
";
+ echo "
";
}
- $conn->close();
?>