MySQL
  Home arrow MySQL arrow Page 11 - The Perfect Job (part 1)
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MYSQL

The Perfect Job (part 1)
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2001-06-28

    Table of Contents:
  • The Perfect Job (part 1)
  • An Ideal World
  • Entry Point
  • Going To The Database
  • The Five Rs
  • Lucky Thirteen
  • Building The Foundation
  • The Devil Is In The Details
  • Applying Yourself
  • Testing Times
  • Filing It All Away

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Perfect Job (part 1) - Filing It All Away


    (Page 11 of 11 )

    At the end of all the validation, the size of the $errorList array is checked. If the size is 0, it implies that no errors were detected, and database insertion begins.

    <? // no errors if (sizeof($errorList) == 0) { // insert personal info $query = "INSERT INTO r_user (jcode, fname, lname, dob, addr1, addr2, city, state, zip, fk_country, phone, email, url, relo, posted) VALUES ('$jcode', '$fname', '$lname', '$dob', '$addr1', '$addr2', '$city', '$state', '$zip', '$country', '$phone', '$email', '$url', '$relo', NOW(''))"; $result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error()); // get resume id, for use in subsequent operations $rid = mysql_insert_id($connection); // insert educational qualifications for($x=0; $x<sizeof($institute); $x++) { if (!empty($institute[$x]) && !empty($degree_year[$x])) { $query = "INSERT INTO r_education (rid, institute, fk_degree, fk_subject, year) VALUES ('$rid', '$institute[$x]', '$degree[$x]', '$subject[$x]', '$degree_year[$x]')"; $result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error()); } } // and so on // print success code echo "Your application has been accepted.<p><a href=job_list.php> Return to job listings</a>"; } else { // or list errors listErrors(); } ?>
    If error messages are present, the listErrors() function is called to display a list of error messages. No database insertion takes place, and the user has the option to return to the previous page to rectify the errors.

    <? // produce a list of errors after validating a form function listErrors() { // read the errorList array global $errorList; // print as list echo "The following errors were encountered: <br>"; echo "<ul>"; for ($x=0; $x<sizeof($errorList); $x++) { echo "<li>$errorList[$x]"; } echo "</ul>"; // link to go back and correct errors echo "Click <a href=javascript:history.back();>here</a> to go back to the previous page and correct the errors"; } ?>
    At this point, all relevant user information has been stored in the various database tables. This is the end of the user process flow; the focus now shifts to data retrieval and maintenance, both of which are exclusively administrative functions.

    In the second part of this article, I'll examine the administration scripts related to adding, editing and deleting job listings, together with a look at a basic search engine to sift through all the data. In the meanwhile, download the code, play with it, send me your thoughts/flames/savings...and come back next time for more!

    This article copyright Melonfire 2001. All rights reserved.
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

       

    MYSQL ARTICLES

    - MySQL Server Tuning Tips and Tricks
    - MySQL Query Optimizations and Schema Design
    - MySQL Benchmarking Tools and Utilities
    - MySQL Benchmarking Concepts and Strategies
    - Take Some Load off MySQL with MemCached
    - MySQL Table Prefix Changer Tool in PHP
    - Using the SIGNAL Statement for Error Handling
    - Error Handling Examples
    - Error Handling
    - Completing a Search Engine with MySQL and PH...
    - Paginating Result Sets for a Search Engine B...
    - Building a Search Engine with MySQL and PHP 5
    - Using Boolean Operators for Full Text and Bo...
    - PHP, MySQL and the PEAR Database
    - Working with PHP and MySQL





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT