// Page Variables
$page_title = "- About the JobBoard";
// Library files
include ("../lib/page.lib"); // page default variables
include ("../lib/font.lib"); // Font Adjuster
include ("../tpl/header.tpl");
include ("../tpl/nav.tpl");
?>
print "$Font $FontColorBodyLink $FontSizeLarger"; ?>About the JobBoard
print "$Font $FontColorBodyLink $FontSizeSmall"; print $Span;?>next->
9/13/00 - Like the rest of the InterNetWorkers' site, the JobBoard makes use of use of print popup("http://www.php.net/", "PHP");?>, albeit more specialized. PHP is a server-side, cross-platform, HTML embedded scripting language similar to print popup("http://support.microsoft.com/support/default.asp?PR=asp&FR=0&SD=MSDN&LN=EN-US", "ASP");?> or print popup("http://www.allaire.com/Products/coldfusion/", "ColdFusion");?>, except that it's print popup("http://www.opensource.org/", "Open Source");?>. The JobBoard also uses print popup("http://www.mysql.com/", "MySQL");?> for its database. MySQL is a relational database management system. See print popup("http://www.mysql.com/", "MySQL.com");?> for more specifics.
The entire JobBoard consists of three pages, and a table in the db. This is what the table looks like.
+--------------------+-------------+-----+--------+ | Field | Type | Null| Default| +--------------------+-------------+-----+--------+ | company_name | varchar(150)| YES | NULL | | company_location | varchar(250)| YES | NULL | | company_contact | varchar(250)| YES | NULL | | company_email | varchar(250)| YES | NULL | | company_website | varchar(250)| YES | NULL | | company_description| text | YES | NULL | | job_title | varchar(150)| YES | NULL | | job_ref_code | varchar(150)| YES | NULL | | job_description | text | YES | NULL | | job_requirements | text | YES | NULL | +--------------------+-------------+-----+--------+You can see that each row in the table will have a field name (describing its content), a field type, an indicator of null state (that is, can the field be empty, or NULL), and the default value. Please note that I'm not a db expert by any stretch of the imagination, so my descriptions are likely to be slightly imprecise. Also, I've removed some of the more sensitive information, for security reasons.
<? $date = date("z"); //get the date $checkdate = (date("z") - 30); // get the date (-30 days) // Connect to the Database $link = mysql_connect("path.to.the.db", "username", "password"); // list the tables in the db $result = mysql_list_tables ("InterNetWorkers"); // create an array that contains the table names above $tb_names[$i] = mysql_tablename ($result, "0"); // Queries don't care for \ characters, and php doesn't // like quotes- this takes care of those issues. $query_string = " != \"\" "; // the actual db query $Find_jobs = mysql_query ("SELECT * FROM jobboard WHERE company_name $query_string AND MOD(timeStamp, 365) >= $checkdate ORDER BY posted_on DESC");The heart of this is the mysql_query. In plain English, it sez, "Select everything from the jobboard when the field 'company_name' isn't empty, and the date of the record isn't more than 30 days old and then sort them based on the date they were posted in descending order."
while($row = mysql_fetch_array($Find_jobs)) { print "Company Name: $row[1]"; print "Company Location: $row[2]"; print "Company Contact: $row[3]"; };This is a really simplified version of what's happening on the actual InterNetWorkers page - you can obviously put lots of html and formatting info inside the print ""; statement. What's not so obvious is that you can evaluate the contents of the array, and add an if function to decide how and whether to display the information.
while($row = mysql_fetch_array($Find_jobs)) { // if row2 is not empty, display it. if ($row[2] != "") { $row[2] = "Company Location: $row[2]"; } print "Company Name: $row[1]"; print "$row[2]"; print "Company Contact: $row[3]"; }; mysql_close ($link); //close the connection to the db ?>Getting the information into the database is somewhat more convoluted - see print "$Font $FontColorBodyLink $FontSizeNone"; print $Span;?>JobBoard Pt. II.