this is to do with my project (see echo forum)
i have a database which contains a catogary/department table with has an id and name table,
what i would like to do is display a nav bar style by css that is driven by the database, so basically when i add a new department to the list it will add a new link.
also i would like this link to go to a page that displays the information of the items/jobs that are associated with that department.
here is the code i done to display ALL the jobs but i woiuld like it to just display the ones from the department,
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>$dsg ($jcode)</a>";
}
echo "</ul>";
echo "<p>";
}
}
and this gives links to link to more infor on the job
if($cmd == "Details"){
if (!$jcode || $jcode == "")
{
header("Location:?cmd=Error");
exit;
}
### Get job details ###
$query = "SELECT listing.designation,
listing.jcode,
department.department,
location.location,
salary.salary,
listing.responsibilities,
listing.qualifications,
listing.cname,
listing.cmail,
listing.posted
from department,
listing,
location,
salary
WHERE department.id = listing.fk_department
AND location.id = listing.fk_location
AND salary.id = listing.fk_salary
AND listing.jcode = '$jcode'";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
### Checking for errors ###
if (mysql_num_rows($result) <= 0)
{
header("Location:?cmd=Error");
exit;
}
else
{
### Obtain data from query ###
list($designation, $jcode, $department, $location, $salary, $description, $qualification, $cname, $cmail, $posted) = mysql_fetch_row($result);
echo "
<!--
Printing job details
-->
<b>Designation:</b> $designation
<p>
<b>Department:</b> $department
<p>
<b>Location:</b> $location
<p>
<b>Salary:</b> $salary
<p>
<b>Responsibilities:</b> $description
<p>
<b>Qualifications:</b> $qualification
<p>
<b>Contact:</b> <a href=mailto:$cmail>$cname</a>
<p>
<b>Job code:</b> $jcode
<p>
<b>Posted on: </b>"; echo fixDate($posted);
echo "
<p>
any help would be greatful