PHP
  Home arrow PHP arrow Page 4 - HTML for a Project Management Application
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
PHP

HTML for a Project Management Application
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 5
    2008-06-09


    Table of Contents:
  • HTML for a Project Management Application
  • Code Explained
  • Source Code for the Page
  • PHP explained

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    HTML for a Project Management Application - PHP explained
    ( Page 4 of 4 )


    The PHP code of the page is very straightforward. The main page of the application sends over the project ID when the hyperlink with the project title is clicked. The view_ project page receives this ID, and then retrieves the project details based on the ID number. If you go back and look at the way our database tables are set up, you will notice that each table, with the exception of the users table, has a project ID field. The view_project page uses the same ID to retrieve project information from the following tables:


    projects, staff, tasks and files


    Once the information is gathered, it is organized and displayed on this page, as you can see from the earlier screen shot. The PHP code starts by including the usual bunch of files and then initializes variables:


    <?php

    include "dbcon.php";

    include "functions.php";

    //initialise variables

    $alert =false;


    Next, it checks whether a project id (pid) is sent over:


    if(isset($_GET['pid'])){



    If so, we start to filter the value. Although this value did not come from a form, we still need to check and verify it, since anyone can modify it while it is displayed in the browser. Because we know that the project ID is a number, it is easy to check it by using the is_numeric() function:


    //clean pid

    if(!is_numeric($_GET['pid'])){

    //the value received is not numeric. redirect the user to login

    header("location:login.php");

    }



    If it is indeed a number, then we need to escape it, before it is used in a MySQL query:


    //otherwise clean the received value for query use

    //get projects

    $projectID = mysql_escape_string($_GET['pid']);


    Once the variable has been escaped, we can retrieve the project details from the project table:


    $getproject= "SELECT * FROM projects WHERE pid = '".$projectID."'";

    $results = mysql_query($getproject);

    $projectdetails = mysql_fetch_assoc($results);



    Then we retrieve all the files that are connected to the project ID from the files table:


    //get project files

    $getfiles = "SELECT * FROM files WHERE p_id = '".$projectID."'";

    $file_res = mysql_query($getfiles);

    if(!$file_res){

    echo mysql_error();

    }else{

    $num_files = mysql_num_rows($file_res);

    }

     

    And finally, we retrieve all the staff members that work on this project from the staff table:



    //get project members

    $getmembers = "SELECT name FROM staff WHERE p_id = '".$projectID."'";

    $staff_res = mysql_query($getmembers);

    if(!$staff_res){

    echo mysql_error();

    }else{

    $num_staff = mysql_num_rows($staff_res);

    }

    }



    The HTML part of the page basically displays the information that is gathered by these queries in an HTML table. If any of the queries return empty, then the appropriate message is displayed.

    Conclusion

    In the next article we will look at how to add new projects and how to change the contents of a project.



     
     
    >>> More PHP Articles          >>> More By David Web
     

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek