Home arrow PHP arrow Page 4 - Time Is Money (part 2)

In... - PHP

In this concluding article, explore the scripts which add andremove timesheet entries to the system, and get a crash course instatistics by using these entries to generate useful resource allocationand usage reports.

TABLE OF CONTENTS:
  1. Time Is Money (part 2)
  2. Getting Creative
  3. Split Personality
  4. In...
  5. ...And Out
  6. The Number Game
  7. Exercising Restraint
  8. The Big Picture...
  9. ...And The Little Brush Strokes
  10. When Things Go Wrong
  11. Happy Endings
By: The Disenchanted Developer, (c) Melonfire
Rating: starstarstarstarstar / 4
November 16, 2001

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
The two halves of "view.php" correspond to two different form processors, "delete.php" and "add.php" respectively. Let's look at "add.php" first.

<? // add.php - add timesheet entry // includes // checks // if all checks pass // open connection to database $connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!"); // create datestamp $datestamp = $y . "-" . $m . "-" . $d; // insert data $query = "INSERT INTO log (pid, tid, uid, hours, date) VALUES ('$pid', '$tid', '$SESSION_UID', '$h', '$datestamp')"; $result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error()); // close connection mysql_close($connection); // redirect back header("Location:view.php?d=$d&m=$m&y=$y"); ?>
The data received from the form in "view.php" - project, task and hour values - is used by this script to formulate an INSERT query and insert the entry into the "log" table. The $SESSION_UID variable is used to identify which user this entry belongs to.

Once the data has been inserted, the browser is redirected back to the page it came from, using the datestamp values passed to it from "view.php".

 
 
>>> More PHP Articles          >>> More By The Disenchanted Developer, (c) Melonfire
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: