Hey everyone,
I am VERY stuck with a problem and don’t know how to fix…
Basically i have a job application process where users apply for a job, in the admin section administrators want to be able to see which applications have not been viewed. Now i have one page which lists all the job vacancies and then users can click into that specific vacancy to see which people have submitted an application. This all works fine.
However on the page i display the job vacancies i need to make it so that if there are any applications within a vacancy that need viewing it appears in RED.
The two tables i am using are below:
tbl_vacancies
job_id
job_name
location
voucher
details
availability
region
date_added
tbl_applications
application_id
job_id
fname
sname
other_info
.
.
.
.
date_addedd
viewed
Now the viewed column is in tbl_applications table, the applications relate to a specific vacancy via the job_id.
So what i need to check is IF there are ANY applications where the viewed = 0, if so that means that there are applications that need to be seen, and i want this to appear in RED.
Now i tried this several ways i.e an INNER JOIN etc… but the full list of vacancies won’t appearing.
So i tried this:
string sqlStr = "SELECT tbl_vacancies.job_id, tbl_vacancies.job_name, " +
"tbl_vacancies.location, tbl_vacancies.voucher, tbl_vacancies.details, " +
"tbl_vacancies.availability, tbl_vacancies.region, " +
"(SELECT tbl_applications.viewed FROM tbl_applications WHERE tbl_applications.ID = tbl_vacancies.job_id) AS VIEWED " +
"FROM tbl_vacancies WHERE tbl_vacancies.availability != 'Archived'";
And then to check i did this:
if (dbReader["VIEWED"] == "0")
{
Label5.Text += "<span style=color:red>You have unread applications!</span>";
}
But it doesn’t work at all. I don’t get any errors and the applications all display fine, but i do the IF and try to check to see if any of the applications have unread applications, it doesn’t work…
Can anyone please help me with this?
Thanks again