I want the code to first check if the logged in user is an admin. If they are an admin, I want it to run the first query (where it shows all records). If they are not an admin, I want it to run the second query which adds a where clause (so it only shows the records of the logged in users username). In my database, admins have a 1 in the admin column, while users have a 0. This is the code i have so far:
[php]if ($admin_session == “1”) {
$query = “SELECT * FROM timesheet
JOIN employee
ON timesheet
.emp_id = employee
.emp_id ORDER BY employee
.emp_id”
} else {
$query = “SELECT * FROM timesheet
JOIN employee
ON timesheet
.emp_id = employee
.emp_id WHERE employee
.username LIKE ‘$login_session’ ORDER BY employee
.emp_id”
}[/php]
Anyone know what I’m doing wrong?