DaCodingMan!28138
New Coder
Hello, I have been stuck on this and figured I would come here to seek assistance. The main objective of this project is to create an intranet and have the employee name link to a details.php which displays details about that specific employee. the problem I am having is that whenever I click on the employee name, it displays the text in the else statement rather than the text within the if statement. What are some ways I can remediate the issue?
Code below:
details.php:
Code below:
details.php:
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div class = "navigation">
<a href = "index.php"> Employees</a>
</div>
<?php
require 'dbConn.php';
echo "<br>";
$employeeid = $_GET['employeeid'];
$sql = 'SELECT e.employee_id, e.last_name, e.first_name, e.email, e.phone_number, d.department_name, j.job_title, e.hire_date, e.salary, d.location_id, l.city, l.state_province, l.country_id
FROM employees as e, departments as d, jobs as j, locations as l
WHERE e.employee_id = $employeeid and e.department_id = d.department_id and e.job_id = j.job_id and d.location_id = l.location_id
ORDER by e.last_name';
$result = $mysqli->query($sql);
$output = array($sql);
if ($result !== false && $result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$output = array($row["first_name"] . $row["last_name"] . "<br>" . $row["job_title"] . $row["hire_date"]);
}
} else {
echo "0 results";
}
$mysqli->close();
?>
</body>
</html>