Here is the code to get the listings from the DB
#####################
Listing open jobs
#####################
if ($cmd =="List"){
### Get List of Open Jobs ###
$query = "SELECT DISTINCT id, department
from department, listing
WHERE department.id = listing.fk_department";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
### Check each department ###
while(list($id, $department) = mysql_fetch_row($result))
{
### Printing department ###
echo "<b>Department:</b> $department";
### Look for jobs in each department and print as list ###
$query2 = "SELECT jcode, designation
from listing
WHERE listing.fk_department = '$id'";
$result2 = mysql_db_query($database, $query2, $connection) or die ("Error in query: $query2. " . mysql_error());
echo "<ul>";
while(list($jcode, $dsg) = mysql_fetch_row($result2))
{
echo "<li><a href=?cmd=Details&jcode=$jcode title= 'View this job posting.'>$dsg ($jcode)</a><br><br>";
}
echo "</ul>";
echo "<p>";
}
}[/COLOR]
#######################
Echoing job details
#######################
if($cmd == "Details"){
if (!$jcode || $jcode == "")
{
header("Location:?cmd=Error");
exit;
}
### Get job details ###
$query = "SELECT listing.jcode,
listing.posted,
listing.opening_date,
listing.closing_date,
listing.designation,
listing.series_grade,
listing.promotion,
listing.salary,
location.location,
listing.who_may_apply,
listing.aditional_duty_location,
listing.responsibilities,
listing.qualifications,
listing.be_evaluated,
listing.how_to_apply,
listing.other_information,
listing.reasonable_accommodation,
listing.eeo,
department.department,
listing.cname,
listing.cmail
from department,
listing,
location
WHERE department.id = listing.fk_department
AND location.id = listing.fk_location
AND listing.jcode = '$jcode'";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
[COLOR=PaleGreen]### Checking for errors ###[/COLOR]
if (mysql_num_rows($result) <= 0)
{
header("Location:?cmd=Error");
exit;
}
else
{
[COLOR=PaleGreen]### Obtain data from query ###[/COLOR]
list($jcode, $posted, $opening_date, $closing_date, $designation, $series_grade, $promotion, $salary, $location, $who_may_apply, $department, $description, $qualification, $be_evaluated, $how_to_apply, $other_information, $reasonable_accommodation, $eeo, $cmail, $cname) = mysql_fetch_row($result);[/COLOR]