In the first part of this article, you built the architecturenecessary to accept and store resumes online. In this concluding part, findout how to make use of the stored data to find suitable candidates for aparticular job, and also read about the functions available to maintain andupdate the job listings.
If you remember, when I first put together the "listings" table, I added a couple of dummy entries to it, just to get things rolling.
Now, that's fine during the early stages of application development...but you can't expect your customers to pop open a mySQL prompt every time they need to update a job listing. For one thing, they may not have the technical acumen necessary to manipulate a mySQL database; for another, they may prefer a pretty GUI to an ugly command-line. Either way, as the developer, you're on the hook to package those functions into your application as well.
Consequently, I'll begin by putting together an entry point for administrators, in much the same way as I did for users. This page will serve as a menu to the different administration functions available.
// admin.php - admin functions entry point
// open connection to database
$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to
// get list of departments with 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());
// generate a table
echo "<table border=0 cellspacing=5 cellpadding=5>";
// iterate through resultset
while(list($id, $department) = mysql_fetch_row($result))
// print department name
echo "<tr><td colspan=4><b>Department:</b> $department</td></tr>";
// look for jobs within the department and print as list, add edit and
$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());
while(list($jcode, $dsg) = mysql_fetch_row($result2))
echo "<tr><td width=10> </td><td>$dsg ($jcode)</td> <td><a
href=edit.php?jcode=$jcode><font size=-1>edit</font></a></td> <td><a
<!-- snip -->
<a href="add.php">Add a new listing</a> or <a href="search.php">search the
<!-- snip -->
Here's what it looks like.
As you can see, it's almost identical to the user entry point, with the exception of the edit and delete links next to each job. Each of these calls a script to perform the appropriate function. The bottom of the page also includes links to add a new listing, or search the database for potential candidates.
It should be noted at this point that access to all these administration scripts should be restricted to privileged users only. The easiest way to do this is to move them into a separate directory, and protect it using Web-based authentication.
This article copyright Melonfire 2001. All rights reserved.