Home arrow MySQL arrow Page 2 - The Perfect Job (part 2)

Administrator Ahoy! - MySQL

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.

  1. The Perfect Job (part 2)
  2. Administrator Ahoy!
  3. Adding To The Mix
  4. Changing Things Around
  5. Building Blocks
  6. Handling The Gray Areas
  7. Endgame
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 2
July 11, 2001

print this article


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 // includes // open connection to database $connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!"); // 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 delete links $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 href=delete.php?jcode=$jcode><font size=-1>delete</font></a></td></tr>"; } } echo "</table>"; ?> <!-- snip --> <a href="add.php">Add a new listing</a> or <a href="search.php">search the database</a> <!-- 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.

>>> More MySQL Articles          >>> More By icarus, (c) Melonfire

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Oracle Unveils MySQL 5.6
- MySQL Vulnerabilities Threaten Databases
- MySQL Cloud Options Expand with Google Cloud...
- MySQL 5.6 Prepped to Handle Demanding Web Use
- ScaleBase Service Virtualizes MySQL Databases
- Oracle Unveils MySQL Conversion Tools
- Akiban Opens Database Software for MySQL Use...
- Oracle Fixes MySQL Bug
- MySQL Databases Vulnerable to Password Hack
- MySQL: Overview of the ALTER TABLE Statement
- MySQL: How to Use the GRANT Statement
- MySQL: Creating, Listing, and Removing Datab...
- MySQL: Create, Show, and Describe Database T...
- MySQL Data and Table Types
- McAfee Releases Audit Plugin for MySQL Users

Developer Shed Affiliates


Dev Shed Tutorial Topics: